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 2021/02/21 00:36:10 UTC
[skywalking] branch master updated: Remove filename suffix in the
meter active file config (#6413)
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 317a658 Remove filename suffix in the meter active file config (#6413)
317a658 is described below
commit 317a6580f3364e6d8bb2548670b286c3457114c8
Author: mrproliu <74...@qq.com>
AuthorDate: Sun Feb 21 08:35:38 2021 +0800
Remove filename suffix in the meter active file config (#6413)
---
CHANGES.md | 1 +
.../oap/server/analyzer/provider/AnalyzerModuleConfig.java | 5 +++--
.../server/analyzer/provider/meter/config/MeterConfigs.java | 13 ++++++++++---
.../server-bootstrap/src/main/resources/application.yml | 2 +-
test/e2e/e2e-test/docker/kafka/docker-compose.meter.yml | 2 +-
test/e2e/e2e-test/docker/meter/docker-compose.yml | 2 +-
6 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index 515d1ab..d417d38 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -25,6 +25,7 @@ Release Notes.
* Enhance `MeterSystem` to allow creating metrics with same `metricName` / `function` / `scope`.
* Storage plugin supports postgresql.
* Fix kubernetes.client.opeanapi.ApiException.
+* Remove filename suffix in the meter active file config.
#### UI
* Update selector scroller to show in all pages.
diff --git a/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/AnalyzerModuleConfig.java b/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/AnalyzerModuleConfig.java
index f13ee99..2d88c64 100644
--- a/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/AnalyzerModuleConfig.java
+++ b/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/AnalyzerModuleConfig.java
@@ -18,6 +18,7 @@
package org.apache.skywalking.oap.server.analyzer.provider;
+import com.google.common.base.Splitter;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@@ -145,10 +146,10 @@ public class AnalyzerModuleConfig extends ModuleConfig {
/**
* Get all files could be meter analyzed, files split by ","
*/
- public String[] meterAnalyzerActiveFileNames() {
+ public List<String> meterAnalyzerActiveFileNames() {
if (StringUtils.isEmpty(this.meterAnalyzerActiveFiles)) {
return null;
}
- return this.meterAnalyzerActiveFiles.split(",");
+ return Splitter.on(",").splitToList(this.meterAnalyzerActiveFiles);
}
}
diff --git a/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/meter/config/MeterConfigs.java b/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/meter/config/MeterConfigs.java
index 09b5399..ac53413 100644
--- a/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/meter/config/MeterConfigs.java
+++ b/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/meter/config/MeterConfigs.java
@@ -20,6 +20,7 @@ package org.apache.skywalking.oap.server.analyzer.provider.meter.config;
import lombok.extern.slf4j.Slf4j;
import org.apache.skywalking.oap.server.library.module.ModuleStartException;
+import org.apache.skywalking.oap.server.library.util.CollectionUtils;
import org.apache.skywalking.oap.server.library.util.ResourceUtils;
import org.yaml.snakeyaml.Yaml;
@@ -43,20 +44,26 @@ public class MeterConfigs {
/**
* Load all configs from path
*/
- public static List<MeterConfig> loadConfig(String path, String[] fileNames) throws ModuleStartException {
- if (fileNames == null || fileNames.length == 0) {
+ public static List<MeterConfig> loadConfig(String path, List<String> fileNames) throws ModuleStartException {
+ if (CollectionUtils.isEmpty(fileNames)) {
return Collections.emptyList();
}
File[] configs;
try {
- configs = ResourceUtils.getPathFiles(path, fileNames);
+ configs = ResourceUtils.getPathFiles(path);
} catch (FileNotFoundException e) {
throw new ModuleStartException("Load meter configs failed", e);
}
return Arrays.stream(configs)
.map(f -> {
+ String fileName = f.getName();
+ int dotIndex = fileName.lastIndexOf('.');
+ fileName = (dotIndex == -1) ? fileName : fileName.substring(0, dotIndex);
+ if (!fileNames.contains(fileName)) {
+ return null;
+ }
try (Reader r = new FileReader(f)) {
return new Yaml().loadAs(r, MeterConfig.class);
} catch (IOException e) {
diff --git a/oap-server/server-bootstrap/src/main/resources/application.yml b/oap-server/server-bootstrap/src/main/resources/application.yml
index 34b4bef..9b5779b 100755
--- a/oap-server/server-bootstrap/src/main/resources/application.yml
+++ b/oap-server/server-bootstrap/src/main/resources/application.yml
@@ -225,7 +225,7 @@ agent-analyzer:
# Exit spans with the component in the list would not generate the client-side instance relation metrics.
noUpstreamRealAddressAgents: ${SW_NO_UPSTREAM_REAL_ADDRESS:6000,9000}
slowTraceSegmentThreshold: ${SW_SLOW_TRACE_SEGMENT_THRESHOLD:-1} # Setting this threshold about the latency would make the slow trace segments sampled if they cost more time, even the sampling mechanism activated. The default value is `-1`, which means would not sample slow traces. Unit, millisecond.
- meterAnalyzerActiveFiles: ${SW_METER_ANALYZER_ACTIVE_FILES:spring-sleuth.yaml} # Which files could be meter analyzed, files split by ","
+ meterAnalyzerActiveFiles: ${SW_METER_ANALYZER_ACTIVE_FILES:spring-sleuth} # Which files could be meter analyzed, files split by ","
log-analyzer:
selector: ${SW_LOG_ANALYZER:default}
diff --git a/test/e2e/e2e-test/docker/kafka/docker-compose.meter.yml b/test/e2e/e2e-test/docker/kafka/docker-compose.meter.yml
index 34df799..a67c97b 100644
--- a/test/e2e/e2e-test/docker/kafka/docker-compose.meter.yml
+++ b/test/e2e/e2e-test/docker/kafka/docker-compose.meter.yml
@@ -26,7 +26,7 @@ services:
SW_KAFKA_FETCHER_PARTITIONS: 2
SW_KAFKA_FETCHER_PARTITIONS_FACTOR: 1
SW_KAFKA_FETCHER_ENABLE_METER_SYSTEM: "true"
- SW_METER_ANALYZER_ACTIVE_FILES: spring-sleuth.yaml
+ SW_METER_ANALYZER_ACTIVE_FILES: spring-sleuth
depends_on:
broker-a:
condition: service_healthy
diff --git a/test/e2e/e2e-test/docker/meter/docker-compose.yml b/test/e2e/e2e-test/docker/meter/docker-compose.yml
index 1428528..4ddc448 100644
--- a/test/e2e/e2e-test/docker/meter/docker-compose.yml
+++ b/test/e2e/e2e-test/docker/meter/docker-compose.yml
@@ -18,7 +18,7 @@ version: '2.1'
services:
oap:
environment:
- SW_METER_ANALYZER_ACTIVE_FILES: spring-sleuth.yaml
+ SW_METER_ANALYZER_ACTIVE_FILES: spring-sleuth
extends:
file: ../base-compose.yml
service: oap