You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/11/22 16:22:49 UTC
(skywalking) branch master updated: Support `Scratch The OAP Config Dump`. (#11579)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new dd09d08c0c Support `Scratch The OAP Config Dump`. (#11579)
dd09d08c0c is described below
commit dd09d08c0cba8d2c66d01cf18a48643e64e040ce
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Thu Nov 23 00:22:41 2023 +0800
Support `Scratch The OAP Config Dump`. (#11579)
---
dist-material/release-docs/LICENSE | 29 +++++---
docs/en/changes/changes.md | 1 +
docs/en/debugging/config_dump.md | 74 ++++++++++++++++++++
docs/en/setup/backend/configuration-vocabulary.md | 2 +
docs/menu.yml | 4 ++
.../oap/server/core/CoreModuleProvider.java | 2 +-
.../server/core/status/ServerStatusService.java | 56 ++++++++++++++-
.../library/module/ApplicationConfiguration.java | 14 ++--
.../{ => debugging-query-plugin}/pom.xml | 26 ++++---
.../oap/query/debug/DebuggingHTTPHandler.java | 43 ++++++++++++
.../oap/query/debug/DebuggingQueryConfig.java | 32 +++++++++
.../oap/query/debug/DebuggingQueryModule.java | 33 +++++++++
.../oap/query/debug/DebuggingQueryProvider.java | 79 ++++++++++++++++++++++
...ywalking.oap.server.library.module.ModuleDefine | 19 ++++++
...alking.oap.server.library.module.ModuleProvider | 19 ++++++
oap-server/server-query-plugin/pom.xml | 15 ++++
oap-server/server-starter/pom.xml | 5 ++
.../oap/server/starter/OAPServerBootstrap.java | 2 +-
.../starter/config/ApplicationConfigLoader.java | 6 ++
.../src/main/resources/application.yml | 6 ++
20 files changed, 437 insertions(+), 30 deletions(-)
diff --git a/dist-material/release-docs/LICENSE b/dist-material/release-docs/LICENSE
index 2f5dc1458c..a6698c37e3 100644
--- a/dist-material/release-docs/LICENSE
+++ b/dist-material/release-docs/LICENSE
@@ -461,9 +461,11 @@ The following components are provided under the MIT License. See project link fo
The text of each license is also included in licenses/LICENSE-[project].txt.
https://npmjs.com/package/@babel/parser/v/7.23.0 7.23.0 MIT
- https://npmjs.com/package/@ctrl/tinycolor/v/3.5.0 3.5.0 MIT
+ https://npmjs.com/package/@ctrl/tinycolor/v/3.6.1 3.6.1 MIT
https://npmjs.com/package/@egjs/hammerjs/v/2.0.17 2.0.17 MIT
- https://npmjs.com/package/@element-plus/icons-vue/v/1.1.4 1.1.4 MIT
+ https://npmjs.com/package/@element-plus/icons-vue/v/2.1.0 2.1.0 MIT
+ https://npmjs.com/package/@floating-ui/core/v/0.7.3 0.7.3 MIT
+ https://npmjs.com/package/@floating-ui/dom/v/0.5.4 0.5.4 MIT
https://npmjs.com/package/@interactjs/actions/v/1.10.17 1.10.17 MIT
https://npmjs.com/package/@interactjs/auto-scroll/v/1.10.17 1.10.17 MIT
https://npmjs.com/package/@interactjs/auto-start/v/1.10.17 1.10.17 MIT
@@ -484,10 +486,10 @@ The text of each license is also included in licenses/LICENSE-[project].txt.
https://npmjs.com/package/@intlify/message-compiler/v/9.2.2 9.2.2 MIT
https://npmjs.com/package/@intlify/shared/v/9.2.2 9.2.2 MIT
https://npmjs.com/package/@intlify/vue-devtools/v/9.2.2 9.2.2 MIT
- https://npmjs.com/package/@popperjs/core/v/2.11.6 2.11.6 MIT
+ https://npmjs.com/package/@popperjs/core/v/2.11.7 2.11.7 MIT
https://npmjs.com/package/@types/hammerjs/v/2.0.41 2.0.41 MIT
https://npmjs.com/package/@types/lodash/v/4.14.191 4.14.191 MIT
- https://npmjs.com/package/@types/lodash-es/v/4.17.6 4.17.6 MIT
+ https://npmjs.com/package/@types/lodash-es/v/4.17.11 4.17.11 MIT
https://npmjs.com/package/@vue/compiler-core/v/3.2.45 3.2.45 MIT
https://npmjs.com/package/@vue/compiler-dom/v/3.2.45 3.2.45 MIT
https://npmjs.com/package/@vue/compiler-sfc/v/3.2.45 3.2.45 MIT
@@ -502,21 +504,28 @@ The text of each license is also included in licenses/LICENSE-[project].txt.
https://npmjs.com/package/@vue/server-renderer/v/3.2.45 3.2.45 MIT
https://npmjs.com/package/@vue/shared/v/3.2.45 3.2.45 MIT
https://npmjs.com/package/async-validator/v/4.2.5 4.2.5 MIT
- https://npmjs.com/package/axios/v/0.24.0 0.24.0 MIT
+ https://npmjs.com/package/asynckit/v/0.4.0 0.4.0 MIT
+ https://npmjs.com/package/axios/v/1.6.0 1.6.0 MIT
+ https://npmjs.com/package/axios/node_modules/form-data/v/4.0.0 4.0.0 MIT
+ https://npmjs.com/package/axios/node_modules/proxy-from-env/v/1.1.0 1.1.0 MIT
https://npmjs.com/package/batch-processor/v/1.0.0 1.0.0 MIT
https://mvnrepository.com/artifact/com.graphql-java-kickstart/graphql-java-tools/13.0.1 MIT
https://mvnrepository.com/artifact/com.graphql-java/graphql-java/21.0 MIT
https://mvnrepository.com/artifact/com.graphql-java/graphql-java-extended-scalars/18.1 MIT
+ https://npmjs.com/package/combined-stream/v/1.0.8 1.0.8 MIT
https://npmjs.com/package/component-emitter/v/1.3.0 1.3.0 MIT
https://npmjs.com/package/cssfilter/v/0.0.10 0.0.10 MIT
https://npmjs.com/package/csstype/v/2.6.21 2.6.21 MIT
https://npmjs.com/package/d3-dsv/node_modules/commander/v/7.2.0 7.2.0 MIT
https://npmjs.com/package/d3-tip/v/0.9.1 0.9.1 MIT
https://npmjs.com/package/dayjs/v/1.11.7 1.11.7 MIT
- https://npmjs.com/package/element-plus/v/2.1.0 2.1.0 MIT
- https://npmjs.com/package/element-plus/node_modules/@vueuse/core/v/7.7.1 7.7.1 MIT
- https://npmjs.com/package/element-plus/node_modules/@vueuse/core/node_modules/@vueuse/shared/v/7.7.1 7.7.1 MIT
- https://npmjs.com/package/element-plus/node_modules/@vueuse/core/node_modules/vue-demi/v/0.13.11 0.13.11 MIT
+ https://npmjs.com/package/delayed-stream/v/1.0.0 1.0.0 MIT
+ https://npmjs.com/package/element-plus/v/2.2.5 2.2.5 MIT
+ https://npmjs.com/package/element-plus/node_modules/@types/web-bluetooth/v/0.0.14 0.0.14 MIT
+ https://npmjs.com/package/element-plus/node_modules/@vueuse/core/v/8.9.4 8.9.4 MIT
+ https://npmjs.com/package/element-plus/node_modules/@vueuse/core/node_modules/@vueuse/shared/v/8.9.4 8.9.4 MIT
+ https://npmjs.com/package/element-plus/node_modules/@vueuse/core/node_modules/vue-demi/v/0.14.6 0.14.6 MIT
+ https://npmjs.com/package/element-plus/node_modules/@vueuse/metadata/v/8.9.4 8.9.4 MIT
https://npmjs.com/package/element-resize-detector/v/1.2.4 1.2.4 MIT
https://npmjs.com/package/escape-html/v/1.0.3 1.0.3 MIT
https://npmjs.com/package/estree-walker/v/2.0.2 2.0.2 MIT
@@ -527,6 +536,8 @@ The text of each license is also included in licenses/LICENSE-[project].txt.
https://npmjs.com/package/lodash-es/v/4.17.21 4.17.21 MIT
https://npmjs.com/package/lodash-unified/v/1.0.3 1.0.3 MIT
https://npmjs.com/package/memoize-one/v/6.0.0 6.0.0 MIT
+ https://npmjs.com/package/mime-db/v/1.52.0 1.52.0 MIT
+ https://npmjs.com/package/mime-types/v/2.1.35 2.1.35 MIT
https://npmjs.com/package/mitt/v/2.1.0 2.1.0 MIT
https://npmjs.com/package/moment/v/2.29.4 2.29.4 MIT
https://npmjs.com/package/monaco-editor/v/0.34.1 0.34.1 MIT
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 69acc4faa8..582eb1ba09 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -47,6 +47,7 @@
* Repleace go2sky E2E to GO agent.
* Replace Metrics v2 protocol with MQE in UI templates and E2E Test.
* Fix incorrect apisix metrics otel rules.
+* Support `Scratch The OAP Config Dump`.
#### UI
diff --git a/docs/en/debugging/config_dump.md b/docs/en/debugging/config_dump.md
new file mode 100644
index 0000000000..78884dee3e
--- /dev/null
+++ b/docs/en/debugging/config_dump.md
@@ -0,0 +1,74 @@
+# Scratch The OAP Config Dump
+
+SkyWalking OAP behaviors could be controlled through hundreds of configurations. It is hard to know what is the final
+configuration as all the configurations could be overrided by system environments.
+
+The core config file [application.yml](../../../oap-server/server-starter/src/main/resources/application.yml) lists all
+the configurations
+and their default values. However, it is still hard to know the runtime value.
+
+Scratch is a tool to dump the final configuration. It is provided within OAP rest server, which could be accessed
+through HTTP GET `http://{core restHost}:{core restPort}/debugging/config/dump`.
+
+```shell
+> curl http://127.0.0.1:12800/debugging/config/dump
+cluster.provider=standalone
+core.provider=default
+core.default.prepareThreads=2
+core.default.restHost=0.0.0.0
+core.default.searchableLogsTags=level,http.status_code
+core.default.role=Mixed
+core.default.persistentPeriod=25
+core.default.syncPeriodHttpUriRecognitionPattern=10
+core.default.restIdleTimeOut=30000
+core.default.dataKeeperExecutePeriod=5
+core.default.topNReportPeriod=10
+core.default.gRPCSslTrustedCAPath=
+core.default.downsampling=[Hour, Day]
+core.default.serviceNameMaxLength=70
+core.default.gRPCSslEnabled=false
+core.default.restPort=12800
+core.default.serviceCacheRefreshInterval=10
+...
+```
+
+All booting configurations with their runtime values are listed, including the selected provider for each module.
+
+## Protect The Secrets
+
+Some of the configurations contain sensitive values, such as username, password, token, etc. These values would be
+masked
+in the dump result. For example, the `storage.elasticsearch.password` in the following configurations,
+
+```yaml
+storage:
+ selector: ${SW_STORAGE:h2}
+ elasticsearch:
+ password: ${SW_ES_PASSWORD:""}
+```
+
+It would be masked and shown as `********` in the dump result.
+
+```shell
+> curl http://127.0.0.1:12800/debugging/config/dump
+...
+storage.elasticsearch.password=********
+...
+```
+
+By default, we mask the config keys through the following configurations.
+
+```yaml
+# Include the list of keywords to filter configurations including secrets. Separate keywords by a comma.
+keywords4MaskingSecretsOfConfig: ${SW_CORE_KEYWORDS_FOR_MASKING_SECRETS:user,password,token,accessKey,secretKey}
+```
+
+## Disable The Config Dump Service
+
+By default, this service is open for helping users to debug and diagnose. If you want to disable it, you need to diable the whole
+`debugging-query` module through setting `selector=-`.
+
+```yaml
+debugging-query:
+ selector: ${SW_DEBUGGING_QUERY:-}
+```
\ No newline at end of file
diff --git a/docs/en/setup/backend/configuration-vocabulary.md b/docs/en/setup/backend/configuration-vocabulary.md
index 961dde11e2..cb4d539a3a 100644
--- a/docs/en/setup/backend/configuration-vocabulary.md
+++ b/docs/en/setup/backend/configuration-vocabulary.md
@@ -308,6 +308,8 @@ The Configuration Vocabulary lists all available configurations provided by `app
| - | - | kafkaTopicLog | Kafka topic name for log. [...]
| - | - | exportErrorStatusTraceOnly | Export error status trace segments through the Kafka channel. [...]
| health-checker | default | checkIntervalSeconds | The period of checking OAP internal health status (in seconds). [...]
+| debugging-query | default | | [...]
+| - | - | keywords4MaskingSecretsOfConfig | Include the list of keywords to filter configurations including secrets. Separate keywords by a comma. [...]
| configuration-discovery | default | disableMessageDigest | If true, agent receives the latest configuration every time, even without making any changes. By default, OAP uses the SHA512 message digest mechanism to detect changes in configuration. [...]
| receiver-event | default | gRPC services that handle events data. | - [...]
| aws-firehose-receiver | default | host | Binding IP of HTTP server [...]
diff --git a/docs/menu.yml b/docs/menu.yml
index a01ed1d4f6..9c05c45777 100644
--- a/docs/menu.yml
+++ b/docs/menu.yml
@@ -323,6 +323,10 @@ catalog:
path: "/en/api/logql-service"
- name: "Security Notice"
path: "/en/security/readme"
+ - name: "Debugging"
+ catalog:
+ - name: "Scratch The OAP Config Dump"
+ path: "en/debugging/config_dump"
- name: "Academy"
catalog:
- name: "Scaling SkyWalking server automatically in kubernetes"
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java
index ef4a2b0767..5599aeba2e 100755
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java
@@ -255,7 +255,7 @@ public class CoreModuleProvider extends ModuleProvider {
httpServer.initialize();
this.registerServiceImplementation(ConfigService.class, new ConfigService(moduleConfig, this));
- this.registerServiceImplementation(ServerStatusService.class, new ServerStatusService(getManager()));
+ this.registerServiceImplementation(ServerStatusService.class, new ServerStatusService(getManager(), moduleConfig));
this.registerServiceImplementation(
DownSamplingConfigService.class, new DownSamplingConfigService(moduleConfig.getDownsampling()));
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/status/ServerStatusService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/status/ServerStatusService.java
index c916a777ff..3559a9de8c 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/status/ServerStatusService.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/status/ServerStatusService.java
@@ -22,6 +22,8 @@ import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
+import org.apache.skywalking.oap.server.core.CoreModuleConfig;
+import org.apache.skywalking.oap.server.library.module.ApplicationConfiguration;
import org.apache.skywalking.oap.server.library.module.ModuleManager;
import org.apache.skywalking.oap.server.library.module.Service;
import org.apache.skywalking.oap.server.telemetry.TelemetryModule;
@@ -38,6 +40,7 @@ import org.apache.skywalking.oap.server.telemetry.api.MetricsTag;
@RequiredArgsConstructor
public class ServerStatusService implements Service {
private final ModuleManager manager;
+ private final CoreModuleConfig moduleConfig;
@Getter
private BootingStatus bootingStatus = new BootingStatus();
@Getter
@@ -45,7 +48,9 @@ public class ServerStatusService implements Service {
private List<ServerStatusWatcher> statusWatchers = new ArrayList<>();
- public void bootedNow(long uptime) {
+ private List<ApplicationConfiguration.ModuleConfiguration> configurations;
+
+ public void bootedNow(List<ApplicationConfiguration.ModuleConfiguration> configurations, long uptime) {
bootingStatus.setBooted(true);
bootingStatus.setUptime(uptime);
manager.find(TelemetryModule.NAME)
@@ -55,6 +60,7 @@ public class ServerStatusService implements Service {
// Set uptime to second
.setValue(uptime / 1000d);
this.statusWatchers.forEach(watcher -> watcher.onServerBooted(bootingStatus));
+ this.configurations = configurations;
}
public void rebalancedCluster(long rebalancedTime) {
@@ -62,7 +68,10 @@ public class ServerStatusService implements Service {
manager.find(TelemetryModule.NAME)
.provider()
.getService(MetricsCreator.class)
- .createGauge("cluster_rebalanced_time", "oap cluster rebalanced time after scale", MetricsTag.EMPTY_KEY, MetricsTag.EMPTY_VALUE)
+ .createGauge(
+ "cluster_rebalanced_time", "oap cluster rebalanced time after scale", MetricsTag.EMPTY_KEY,
+ MetricsTag.EMPTY_VALUE
+ )
.setValue(rebalancedTime / 1000d);
this.statusWatchers.forEach(watcher -> watcher.onClusterRebalanced(clusterStatus));
@@ -71,4 +80,47 @@ public class ServerStatusService implements Service {
public void registerWatcher(ServerStatusWatcher watcher) {
this.statusWatchers.add(watcher);
}
+
+ /**
+ * @return a complete list of booting configurations with effected values.
+ * @since 9.7.0
+ */
+ public String dumpBootingConfigurations(String keywords4MaskingSecretsOfConfig) {
+ if (configurations == null || configurations.isEmpty()) {
+ return "No available booting configurations.";
+ }
+ final String[] keywords = keywords4MaskingSecretsOfConfig.split(",");
+ StringBuilder configList = new StringBuilder();
+ for (ApplicationConfiguration.ModuleConfiguration configuration : configurations) {
+ final String moduleName = configuration.getModuleName();
+ if (configuration.getProviders().size() == 1) {
+ configList.append(moduleName)
+ .append(".provider=")
+ .append(configuration.getProviders().keySet().iterator().next())
+ .append("\n");
+ }
+ configuration.getProviders().forEach(
+ (providerName, providerConfiguration) ->
+ providerConfiguration.getProperties().forEach(
+ (key, value) -> {
+ for (final String keyword : keywords) {
+ if (key.toString().toLowerCase().contains(keyword.toLowerCase())) {
+ value = "******";
+ }
+ }
+
+ configList.append(moduleName)
+ .append(".")
+ .append(providerName)
+ .append(".")
+ .append(key)
+ .append("=")
+ .append(value)
+ .append("\n");
+ }
+ )
+ );
+ }
+ return configList.toString();
+ }
}
diff --git a/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ApplicationConfiguration.java b/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ApplicationConfiguration.java
index 9a7ac14265..8c295bd36d 100644
--- a/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ApplicationConfiguration.java
+++ b/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ApplicationConfiguration.java
@@ -20,6 +20,7 @@ package org.apache.skywalking.oap.server.library.module;
import java.util.HashMap;
import java.util.Properties;
+import lombok.Getter;
/**
* Modularization configurations. The {@link ModuleManager} is going to start, lookup, start modules based on this.
@@ -32,7 +33,7 @@ public class ApplicationConfiguration {
}
public ModuleConfiguration addModule(String moduleName) {
- ModuleConfiguration newModule = new ModuleConfiguration();
+ ModuleConfiguration newModule = new ModuleConfiguration(moduleName);
modules.put(moduleName, newModule);
return newModule;
}
@@ -49,9 +50,13 @@ public class ApplicationConfiguration {
* The configurations about a certain module.
*/
public static class ModuleConfiguration {
+ @Getter
+ private final String moduleName;
+ @Getter
private HashMap<String, ProviderConfiguration> providers = new HashMap<>();
- private ModuleConfiguration() {
+ private ModuleConfiguration(String moduleName) {
+ this.moduleName = moduleName;
}
public Properties getProviderConfiguration(String name) {
@@ -73,14 +78,11 @@ public class ApplicationConfiguration {
* The configuration about a certain provider of a module.
*/
public static class ProviderConfiguration {
+ @Getter
private Properties properties;
ProviderConfiguration(Properties properties) {
this.properties = properties;
}
-
- private Properties getProperties() {
- return properties;
- }
}
}
diff --git a/oap-server/server-query-plugin/pom.xml b/oap-server/server-query-plugin/debugging-query-plugin/pom.xml
similarity index 62%
copy from oap-server/server-query-plugin/pom.xml
copy to oap-server/server-query-plugin/debugging-query-plugin/pom.xml
index a5c4cade4b..038be9eada 100644
--- a/oap-server/server-query-plugin/pom.xml
+++ b/oap-server/server-query-plugin/debugging-query-plugin/pom.xml
@@ -17,20 +17,24 @@
~
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <artifactId>oap-server</artifactId>
+ <artifactId>server-query-plugin</artifactId>
<groupId>org.apache.skywalking</groupId>
<version>9.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>server-query-plugin</artifactId>
- <packaging>pom</packaging>
- <modules>
- <module>query-graphql-plugin</module>
- <module>zipkin-query-plugin</module>
- <module>promql-plugin</module>
- <module>logql-plugin</module>
- </modules>
-</project>
+ <artifactId>debugging-query-plugin</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>server-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git a/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingHTTPHandler.java b/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingHTTPHandler.java
new file mode 100644
index 0000000000..cd6ef86f5f
--- /dev/null
+++ b/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingHTTPHandler.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.query.debug;
+
+import com.linecorp.armeria.server.annotation.Get;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.skywalking.oap.server.core.CoreModule;
+import org.apache.skywalking.oap.server.core.status.ServerStatusService;
+import org.apache.skywalking.oap.server.library.module.ModuleManager;
+
+@Slf4j
+public class DebuggingHTTPHandler {
+ private final ServerStatusService serverStatusService;
+ final DebuggingQueryConfig config;
+
+ public DebuggingHTTPHandler(final ModuleManager manager, final DebuggingQueryConfig config) {
+ serverStatusService = manager.find(CoreModule.NAME)
+ .provider()
+ .getService(ServerStatusService.class);
+ this.config = config;
+ }
+
+ @Get("/debugging/config/dump")
+ public String dumpConfigurations() {
+ return serverStatusService.dumpBootingConfigurations(config.getKeywords4MaskingSecretsOfConfig());
+ }
+}
diff --git a/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingQueryConfig.java b/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingQueryConfig.java
new file mode 100644
index 0000000000..217ced2427
--- /dev/null
+++ b/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingQueryConfig.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.query.debug;
+
+import lombok.Getter;
+import org.apache.skywalking.oap.server.library.module.ModuleConfig;
+
+@Getter
+public class DebuggingQueryConfig extends ModuleConfig {
+ /**
+ * Include the list of keywords to filter configurations including secrets. Separate keywords by a comma.
+ *
+ * @since 9.7.0
+ */
+ private String keywords4MaskingSecretsOfConfig = "user,password,token,accessKey,secretKey,authentication";
+}
diff --git a/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingQueryModule.java b/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingQueryModule.java
new file mode 100644
index 0000000000..02b5fd5991
--- /dev/null
+++ b/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingQueryModule.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.query.debug;
+
+import org.apache.skywalking.oap.server.library.module.ModuleDefine;
+
+public class DebuggingQueryModule extends ModuleDefine {
+ public static final String NAME = "debugging-query";
+
+ public DebuggingQueryModule() {
+ super(NAME);
+ }
+
+ public Class[] services() {
+ return new Class[0];
+ }
+}
diff --git a/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingQueryProvider.java b/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingQueryProvider.java
new file mode 100644
index 0000000000..a3618feffb
--- /dev/null
+++ b/oap-server/server-query-plugin/debugging-query-plugin/src/main/java/org/apache/skywalking/oap/query/debug/DebuggingQueryProvider.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.query.debug;
+
+import com.linecorp.armeria.common.HttpMethod;
+import java.util.Collections;
+import org.apache.skywalking.oap.server.core.CoreModule;
+import org.apache.skywalking.oap.server.core.server.HTTPHandlerRegister;
+import org.apache.skywalking.oap.server.library.module.ModuleConfig;
+import org.apache.skywalking.oap.server.library.module.ModuleDefine;
+import org.apache.skywalking.oap.server.library.module.ModuleProvider;
+import org.apache.skywalking.oap.server.library.module.ModuleStartException;
+import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException;
+
+public class DebuggingQueryProvider extends ModuleProvider {
+ public static final String NAME = "default";
+
+ private DebuggingQueryConfig config;
+
+ public String name() {
+ return NAME;
+ }
+
+ public Class<? extends ModuleDefine> module() {
+ return DebuggingQueryModule.class;
+ }
+
+ public ConfigCreator<? extends ModuleConfig> newConfigCreator() {
+ return new ConfigCreator<DebuggingQueryConfig>() {
+ @Override
+ public Class<DebuggingQueryConfig> type() {
+ return DebuggingQueryConfig.class;
+ }
+
+ @Override
+ public void onInitialized(final DebuggingQueryConfig initialized) {
+ config = initialized;
+ }
+ };
+ }
+
+ public void prepare() throws ServiceNotProvidedException {
+
+ }
+
+ public void start() throws ServiceNotProvidedException {
+ HTTPHandlerRegister service = getManager().find(CoreModule.NAME)
+ .provider()
+ .getService(HTTPHandlerRegister.class);
+ service.addHandler(
+ new DebuggingHTTPHandler(getManager(), config),
+ Collections.singletonList(HttpMethod.GET)
+ );
+ }
+
+ public void notifyAfterCompleted() throws ServiceNotProvidedException, ModuleStartException {
+
+ }
+
+ public String[] requiredModules() {
+ return new String[] {CoreModule.NAME};
+ }
+}
diff --git a/oap-server/server-query-plugin/debugging-query-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine b/oap-server/server-query-plugin/debugging-query-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine
new file mode 100644
index 0000000000..0a5b82263a
--- /dev/null
+++ b/oap-server/server-query-plugin/debugging-query-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+org.apache.skywalking.oap.query.debug.DebuggingQueryModule
diff --git a/oap-server/server-query-plugin/debugging-query-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider b/oap-server/server-query-plugin/debugging-query-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider
new file mode 100644
index 0000000000..32aee0d7b1
--- /dev/null
+++ b/oap-server/server-query-plugin/debugging-query-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+org.apache.skywalking.oap.query.debug.DebuggingQueryProvider
\ No newline at end of file
diff --git a/oap-server/server-query-plugin/pom.xml b/oap-server/server-query-plugin/pom.xml
index a5c4cade4b..124c163b27 100644
--- a/oap-server/server-query-plugin/pom.xml
+++ b/oap-server/server-query-plugin/pom.xml
@@ -23,6 +23,20 @@
<groupId>org.apache.skywalking</groupId>
<version>9.7.0-SNAPSHOT</version>
</parent>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>library-module</artifactId>
+ <version>9.7.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>server-core</artifactId>
+ <version>9.7.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
<modelVersion>4.0.0</modelVersion>
<artifactId>server-query-plugin</artifactId>
@@ -32,5 +46,6 @@
<module>zipkin-query-plugin</module>
<module>promql-plugin</module>
<module>logql-plugin</module>
+ <module>debugging-query-plugin</module>
</modules>
</project>
diff --git a/oap-server/server-starter/pom.xml b/oap-server/server-starter/pom.xml
index a6248138e6..7b41fd091b 100644
--- a/oap-server/server-starter/pom.xml
+++ b/oap-server/server-starter/pom.xml
@@ -111,6 +111,11 @@
<artifactId>zipkin-query-plugin</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>debugging-query-plugin</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>envoy-metrics-receiver-plugin</artifactId>
diff --git a/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/OAPServerBootstrap.java b/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/OAPServerBootstrap.java
index 4814f25285..fe2d1feec5 100644
--- a/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/OAPServerBootstrap.java
+++ b/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/OAPServerBootstrap.java
@@ -54,7 +54,7 @@ public class OAPServerBootstrap {
manager.find(CoreModule.NAME)
.provider()
.getService(ServerStatusService.class)
- .bootedNow(System.currentTimeMillis());
+ .bootedNow(configLoader.getResolvedConfigurations(), System.currentTimeMillis());
if (RunningMode.isInitMode()) {
log.info("OAP starts up in init mode successfully, exit now...");
diff --git a/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java b/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
index ea2b6acc7c..e7f572c3cf 100644
--- a/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
+++ b/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
@@ -18,6 +18,8 @@
package org.apache.skywalking.oap.server.starter.config;
+import java.util.List;
+import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.skywalking.oap.server.library.module.ApplicationConfiguration;
import org.apache.skywalking.oap.server.library.module.ProviderNotFoundException;
@@ -47,10 +49,13 @@ public class ApplicationConfigLoader implements ConfigLoader<ApplicationConfigur
private final TerminalFriendlyTable bootingParameters;
private final Yaml yaml;
+ @Getter
+ private final List<ApplicationConfiguration.ModuleConfiguration> resolvedConfigurations;
public ApplicationConfigLoader(final TerminalFriendlyTable bootingParameters) {
this.bootingParameters = bootingParameters;
this.yaml = new Yaml();
+ this.resolvedConfigurations = new ArrayList<>();
}
@Override
@@ -97,6 +102,7 @@ public class ApplicationConfigLoader implements ConfigLoader<ApplicationConfigur
});
}
moduleConfiguration.addProviderConfiguration(providerName, properties);
+ resolvedConfigurations.add(moduleConfiguration);
});
} else {
log.warn(
diff --git a/oap-server/server-starter/src/main/resources/application.yml b/oap-server/server-starter/src/main/resources/application.yml
index f9caeff0c7..44680896cb 100644
--- a/oap-server/server-starter/src/main/resources/application.yml
+++ b/oap-server/server-starter/src/main/resources/application.yml
@@ -535,6 +535,12 @@ health-checker:
default:
checkIntervalSeconds: ${SW_HEALTH_CHECKER_INTERVAL_SECONDS:5}
+debugging-query:
+ selector: ${SW_DEBUGGING_QUERY:default}
+ default:
+ # Include the list of keywords to filter configurations including secrets. Separate keywords by a comma.
+ keywords4MaskingSecretsOfConfig: ${SW_DEBUGGING_QUERY_KEYWORDS_FOR_MASKING_SECRETS:user,password,token,accessKey,secretKey,authentication}
+
configuration-discovery:
selector: ${SW_CONFIGURATION_DISCOVERY:default}
default: