diff --git a/CHANGES.md b/CHANGES.md
index e9a0e0addb216e2026fb7d95ac031f04847b146c..2641413f18735ff13b0cbefe18f8fc44b5a42ecf 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -12,6 +12,7 @@ Release Notes.
#### OAP-Backend
* Add the `@SuperDataset` annotation for BrowserErrorLog.
+* Support choose files to active the meter analyzer.
* Improve Kubernetes service registry for ALS analysis.
#### UI
diff --git a/apm-dist-es7/src/main/assembly/binary-es7.xml b/apm-dist-es7/src/main/assembly/binary-es7.xml
index 9c2a74c6c5c6ab5523d00a8505442875dc18fe6e..70180075da3d1ad1b6fb318fd5c03528f6a9953f 100644
--- a/apm-dist-es7/src/main/assembly/binary-es7.xml
+++ b/apm-dist-es7/src/main/assembly/binary-es7.xml
@@ -53,7 +53,7 @@
endpoint-name-grouping.yml
oal/*.oal
fetcher-prom-rules/*.yaml
- meter-receive-config/*.yaml
+ meter-analyzer-config/*.yaml
oc-rules/*
ui-initialized-templates/*
diff --git a/apm-dist/src/main/assembly/binary.xml b/apm-dist/src/main/assembly/binary.xml
index b61d99f1a6ee69f199f885a58b87dea02588c26c..6e9f7dd9f29b364066afa6288ab3414ada79687c 100644
--- a/apm-dist/src/main/assembly/binary.xml
+++ b/apm-dist/src/main/assembly/binary.xml
@@ -53,7 +53,7 @@
endpoint-name-grouping.yml
oal/*.oal
fetcher-prom-rules/*.yaml
- meter-receive-config/*.yaml
+ meter-analyzer-config/*.yaml
oc-rules/*
ui-initialized-templates/*
diff --git a/docs/en/setup/backend/backend-meter.md b/docs/en/setup/backend/backend-meter.md
index de7f467527564f99a71a76646e6e8b02fba593fd..2e627e1cb30e3cd1ac3988300557f63a206a5a41 100644
--- a/docs/en/setup/backend/backend-meter.md
+++ b/docs/en/setup/backend/backend-meter.md
@@ -23,11 +23,11 @@ Meter receiver is configured via a configuration file. The configuration file de
from agents, as well as which rule files to load.
OAP can load the configuration at bootstrap. If the new configuration is not well-formed, OAP fails to start up. The files
-are located at `$CLASSPATH/meter-receive-config`.
+are located at `$CLASSPATH/meter-analyzer-config`.
The file is written in YAML format, defined by the scheme described below. Brackets indicate that a parameter is optional.
-A example can be found [here](../../../../oap-server/server-bootstrap/src/main/resources/meter-receive-config/spring-sleuth.yaml).
+A example can be found [here](../../../../oap-server/server-bootstrap/src/main/resources/meter-analyzer-config/spring-sleuth.yaml).
If you're using Spring sleuth, you could use [Spring Sleuth Setup](spring-sleuth-setup.md).
### Meters configure
diff --git a/docs/en/setup/backend/configuration-vocabulary.md b/docs/en/setup/backend/configuration-vocabulary.md
index 2562fb7be0a304b6c3fad10da398290968973b0c..1d8b07f98f704104646f05b7ea0fd93c9ac41c8d 100644
--- a/docs/en/setup/backend/configuration-vocabulary.md
+++ b/docs/en/setup/backend/configuration-vocabulary.md
@@ -145,6 +145,7 @@ core|default|role|Option values, `Mixed/Receiver/Aggregator`. **Receiver** mode
| - | - |forceSampleErrorSegment|When sampling mechanism activated, this config would make the error status segment sampled, ignoring the sampling rate.|SW_FORCE_SAMPLE_ERROR_SEGMENT|true|
| - | - |segmentStatusAnalysisStrategy|Determine the final segment status from the status of spans. Available values are `FROM_SPAN_STATUS` , `FROM_ENTRY_SPAN` and `FROM_FIRST_SPAN`. `FROM_SPAN_STATUS` represents the segment status would be error if any span is in error status. `FROM_ENTRY_SPAN` means the segment status would be determined by the status of entry spans only. `FROM_FIRST_SPAN` means the segment status would be determined by the status of the first span only.|SW_SEGMENT_STATUS_ANALYSIS_STRATEGY|FROM_SPAN_STATUS|
| - | - |noUpstreamRealAddressAgents|Exit spans with the component in the list would not generate the client-side instance relation metrics. As some tracing plugins can't collect the real peer ip address, such as Nginx-LUA and Envoy. |SW_NO_UPSTREAM_REAL_ADDRESS|6000,9000|
+| - | - |meterAnalyzerActiveFiles|Which files could be meter analyzed, files split by ","|SW_METER_ANALYZER_ACTIVE_FILES||
| receiver-sharing-server|default| Sharing server provides new gRPC and restful servers for data collection. Ana make the servers in the core module working for internal communication only.| - | - |
| - | - | restHost| Binding IP of restful service. Services include GraphQL query and HTTP data report| - | - |
| - | - | restPort | Binding port of restful service | - | - |
diff --git a/docs/en/setup/backend/spring-sleuth-setup.md b/docs/en/setup/backend/spring-sleuth-setup.md
index 8750cb6604b167e99c4ddcc597a0928b26e98161..c99452221eaa6ed68f3eb2140abc5018a14195e3 100644
--- a/docs/en/setup/backend/spring-sleuth-setup.md
+++ b/docs/en/setup/backend/spring-sleuth-setup.md
@@ -36,7 +36,7 @@ receiver-meter:
default:
```
-2. Configure the meter config file, It already has the [spring sleuth meter config](../../../../oap-server/server-bootstrap/src/main/resources/meter-receive-config/spring-sleuth.yaml).
+2. Configure the meter config file, It already has the [spring sleuth meter config](../../../../oap-server/server-bootstrap/src/main/resources/meter-analyzer-config/spring-sleuth.yaml).
If you also has some customized meter at the agent side, please read [meter document](backend-meter.md#meters-configure) to configure meter.
## Add UI dashboard
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 760ec5d1b8155351cd8c05a0fb86000a3151c51d..72f2980813de5b883b2e68b7bbf18409e68d8840 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,11 +18,10 @@
package org.apache.skywalking.oap.server.analyzer.provider;
-import java.util.ArrayList;
-import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
import org.apache.skywalking.oap.server.analyzer.provider.trace.DBLatencyThresholdsAndWatcher;
import org.apache.skywalking.oap.server.analyzer.provider.trace.TraceSampleRateWatcher;
import org.apache.skywalking.oap.server.analyzer.provider.trace.UninstrumentedGatewaysConfig;
@@ -30,6 +29,9 @@ import org.apache.skywalking.oap.server.analyzer.provider.trace.parser.listener.
import org.apache.skywalking.oap.server.core.Const;
import org.apache.skywalking.oap.server.library.module.ModuleConfig;
+import java.util.ArrayList;
+import java.util.List;
+
import static org.apache.skywalking.oap.server.analyzer.provider.trace.parser.listener.strategy.SegmentStatusStrategy.FROM_SPAN_STATUS;
@Slf4j
@@ -83,7 +85,13 @@ public class AnalyzerModuleConfig extends ModuleConfig {
private int maxSlowSQLLength = 2000;
@Getter
- private final String configPath = "meter-receive-config";
+ private final String configPath = "meter-analyzer-config";
+
+ /**
+ * Which files could be meter analyzed, files split by ","
+ */
+ @Setter
+ private String meterAnalyzerActiveFiles = Const.EMPTY_STRING;
/**
* Sample the trace segment if the segment has span(s) tagged as error status, and ignore the sampleRate
@@ -123,4 +131,14 @@ public class AnalyzerModuleConfig extends ModuleConfig {
}
return virtualPeers.contains(componentId);
}
+
+ /**
+ * Get all files could be meter analyzed, files split by ","
+ */
+ public String[] meterAnalyzerActiveFileNames() {
+ if (StringUtils.isEmpty(this.meterAnalyzerActiveFiles)) {
+ return null;
+ }
+ return this.meterAnalyzerActiveFiles.split(",");
+ }
}
diff --git a/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/AnalyzerModuleProvider.java b/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/AnalyzerModuleProvider.java
index 22bf19f244668d05d25f242d9f82bc579648e497..2f87675d7bb3cefa10b49b52c3df08ce28be154f 100644
--- a/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/AnalyzerModuleProvider.java
+++ b/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/AnalyzerModuleProvider.java
@@ -18,7 +18,6 @@
package org.apache.skywalking.oap.server.analyzer.provider;
-import java.util.List;
import lombok.Getter;
import org.apache.skywalking.oap.server.analyzer.module.AnalyzerModule;
import org.apache.skywalking.oap.server.analyzer.provider.meter.config.MeterConfig;
@@ -46,6 +45,8 @@ import org.apache.skywalking.oap.server.library.module.ModuleStartException;
import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException;
import org.apache.skywalking.oap.server.telemetry.TelemetryModule;
+import java.util.List;
+
public class AnalyzerModuleProvider extends ModuleProvider {
@Getter
private final AnalyzerModuleConfig moduleConfig;
@@ -96,7 +97,7 @@ public class AnalyzerModuleProvider extends ModuleProvider {
segmentParserService = new SegmentParserServiceImpl(getManager(), moduleConfig);
this.registerServiceImplementation(ISegmentParserService.class, segmentParserService);
- meterConfigs = MeterConfigs.loadConfig(moduleConfig.getConfigPath());
+ meterConfigs = MeterConfigs.loadConfig(moduleConfig.getConfigPath(), moduleConfig.meterAnalyzerActiveFileNames());
processService = new MeterProcessService(getManager());
this.registerServiceImplementation(IMeterProcessService.class, processService);
}
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 1c0745b5ed4aa7ddaefa74b9b1174e4ace4d8c7a..ea2e643a26f461042465cba12df44a747468f4ac 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
@@ -30,6 +30,7 @@ import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -43,10 +44,14 @@ public class MeterConfigs {
/**
* Load all configs from path
*/
- public static List loadConfig(String path) throws ModuleStartException {
+ public static List loadConfig(String path, String[] fileNames) throws ModuleStartException {
+ if (fileNames == null || fileNames.length == 0) {
+ return Collections.emptyList();
+ }
+
File[] configs;
try {
- configs = ResourceUtils.getPathFiles(path);
+ configs = ResourceUtils.getPathFiles(path, fileNames);
} catch (FileNotFoundException e) {
throw new ModuleStartException("Load meter configs failed", e);
}
diff --git a/oap-server/analyzer/agent-analyzer/src/test/java/org/apache/skywalking/oap/server/analyzer/provider/meter/process/MeterBaseTest.java b/oap-server/analyzer/agent-analyzer/src/test/java/org/apache/skywalking/oap/server/analyzer/provider/meter/process/MeterBaseTest.java
index 4dd3cd6aede219dd0cc19b44c3c17edfb3fc2504..8e7608b5ca4f7ce3954f4b7199ca7fbb93a4026c 100644
--- a/oap-server/analyzer/agent-analyzer/src/test/java/org/apache/skywalking/oap/server/analyzer/provider/meter/process/MeterBaseTest.java
+++ b/oap-server/analyzer/agent-analyzer/src/test/java/org/apache/skywalking/oap/server/analyzer/provider/meter/process/MeterBaseTest.java
@@ -19,8 +19,6 @@
package org.apache.skywalking.oap.server.analyzer.provider.meter.process;
import com.google.common.collect.Maps;
-import java.util.HashMap;
-import java.util.List;
import org.apache.skywalking.apm.network.language.agent.v3.Label;
import org.apache.skywalking.apm.network.language.agent.v3.MeterBucketValue;
import org.apache.skywalking.apm.network.language.agent.v3.MeterData;
@@ -41,10 +39,13 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.powermock.reflect.Whitebox;
+import java.util.HashMap;
+import java.util.List;
+
import static org.mockito.Mockito.when;
public abstract class MeterBaseTest {
- private static final String CONFIG_PATH = "meter-receive-config";
+ private static final String CONFIG_PATH = "meter-analyzer-config";
@Mock
protected CoreModuleProvider moduleProvider;
@@ -80,7 +81,7 @@ public abstract class MeterBaseTest {
Whitebox.setInternalState(meterSystem, "functionRegister", map);
// load context
- List meterConfigs = MeterConfigs.loadConfig(CONFIG_PATH);
+ List meterConfigs = MeterConfigs.loadConfig(CONFIG_PATH, new String[] {"config.yaml"});
final MeterProcessService service = new MeterProcessService(moduleManager);
service.start(meterConfigs);
diff --git a/oap-server/analyzer/agent-analyzer/src/test/java/org/apache/skywalking/oap/server/analyzer/provider/meter/process/MeterProcessContextTest.java b/oap-server/analyzer/agent-analyzer/src/test/java/org/apache/skywalking/oap/server/analyzer/provider/meter/process/MeterProcessContextTest.java
index 3f65b14f1cda154d5257436aa1a8e78333ac9449..c587534fb2db168a6fdd291d13341552a7b92a8e 100644
--- a/oap-server/analyzer/agent-analyzer/src/test/java/org/apache/skywalking/oap/server/analyzer/provider/meter/process/MeterProcessContextTest.java
+++ b/oap-server/analyzer/agent-analyzer/src/test/java/org/apache/skywalking/oap/server/analyzer/provider/meter/process/MeterProcessContextTest.java
@@ -18,7 +18,6 @@
package org.apache.skywalking.oap.server.analyzer.provider.meter.process;
-import java.util.List;
import org.apache.skywalking.oap.server.analyzer.provider.meter.config.MeterConfig;
import org.apache.skywalking.oap.server.analyzer.provider.meter.config.MeterConfigs;
import org.apache.skywalking.oap.server.library.module.ModuleStartException;
@@ -29,6 +28,8 @@ import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
+import java.util.List;
+
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -36,11 +37,11 @@ import static org.mockito.Mockito.verify;
@RunWith(PowerMockRunner.class)
@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*", "org.w3c.*"})
public class MeterProcessContextTest extends MeterBaseTest {
- private static final String CONFIG_PATH = "meter-receive-config";
+ private static final String CONFIG_PATH = "meter-analyzer-config";
@Test
public void testInitMeter() throws ModuleStartException {
- List meterConfigs = MeterConfigs.loadConfig(CONFIG_PATH);
+ List meterConfigs = MeterConfigs.loadConfig(CONFIG_PATH, new String[] {"config.yaml"});
final MeterProcessService service = new MeterProcessService(moduleManager);
service.start(meterConfigs);
@@ -51,7 +52,7 @@ public class MeterProcessContextTest extends MeterBaseTest {
@Test
public void testCreateNewProcessor() throws ModuleStartException {
- List meterConfigs = MeterConfigs.loadConfig(CONFIG_PATH);
+ List meterConfigs = MeterConfigs.loadConfig(CONFIG_PATH, new String[] {"config.yaml"});
final MeterProcessService service = new MeterProcessService(moduleManager);
service.start(meterConfigs);
diff --git a/oap-server/analyzer/agent-analyzer/src/test/resources/meter-receive-config/config.yaml b/oap-server/analyzer/agent-analyzer/src/test/resources/meter-analyzer-config/config.yaml
similarity index 100%
rename from oap-server/analyzer/agent-analyzer/src/test/resources/meter-receive-config/config.yaml
rename to oap-server/analyzer/agent-analyzer/src/test/resources/meter-analyzer-config/config.yaml
diff --git a/oap-server/server-bootstrap/pom.xml b/oap-server/server-bootstrap/pom.xml
index d11806cc9d4295d685e0d97522daadbdfaf96710..954426b4e1487a4c531ccbd3cfcfb726a43dcf14 100644
--- a/oap-server/server-bootstrap/pom.xml
+++ b/oap-server/server-bootstrap/pom.xml
@@ -259,7 +259,7 @@
endpoint-name-grouping.yml
oal/
fetcher-prom-rules/
- meter-receive-config/
+ meter-analyzer-config/
oc-rules/
ui-initialized-templates/
diff --git a/oap-server/server-bootstrap/src/main/resources/application.yml b/oap-server/server-bootstrap/src/main/resources/application.yml
index eaa2e4adbb483f2b860c37b058ed54c63cc4941b..edb702f90b4aae7a89743e88462d8f1f56cddf39 100755
--- a/oap-server/server-bootstrap/src/main/resources/application.yml
+++ b/oap-server/server-bootstrap/src/main/resources/application.yml
@@ -191,6 +191,7 @@ agent-analyzer:
# Nginx and Envoy agents can't get the real remote address.
# 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}
+ meterAnalyzerActiveFiles: ${SW_METER_ANALYZER_ACTIVE_FILES:} # Which files could be meter analyzed, files split by ","
receiver-sharing-server:
selector: ${SW_RECEIVER_SHARING_SERVER:default}
@@ -269,7 +270,7 @@ kafka-fetcher:
consumePartitions: ${SW_KAFKA_FETCHER_CONSUME_PARTITIONS:""}
receiver-meter:
- selector: ${SW_RECEIVER_METER:-}
+ selector: ${SW_RECEIVER_METER:default}
default:
receiver-oc:
diff --git a/oap-server/server-bootstrap/src/main/resources/meter-receive-config/spring-sleuth.yaml b/oap-server/server-bootstrap/src/main/resources/meter-analyzer-config/spring-sleuth.yaml
similarity index 100%
rename from oap-server/server-bootstrap/src/main/resources/meter-receive-config/spring-sleuth.yaml
rename to oap-server/server-bootstrap/src/main/resources/meter-analyzer-config/spring-sleuth.yaml
diff --git a/oap-server/server-fetcher-plugin/kafka-fetcher-plugin/src/main/java/org/apache/skywalking/oap/server/analyzer/agent/kafka/module/KafkaFetcherConfig.java b/oap-server/server-fetcher-plugin/kafka-fetcher-plugin/src/main/java/org/apache/skywalking/oap/server/analyzer/agent/kafka/module/KafkaFetcherConfig.java
index f5de711cd679220c6b34acc0e1f86ee125e25b3d..c7b6239ee33b27ec7a6cd17522a4cd98e474f26e 100644
--- a/oap-server/server-fetcher-plugin/kafka-fetcher-plugin/src/main/java/org/apache/skywalking/oap/server/analyzer/agent/kafka/module/KafkaFetcherConfig.java
+++ b/oap-server/server-fetcher-plugin/kafka-fetcher-plugin/src/main/java/org/apache/skywalking/oap/server/analyzer/agent/kafka/module/KafkaFetcherConfig.java
@@ -18,10 +18,11 @@
package org.apache.skywalking.oap.server.analyzer.agent.kafka.module;
-import java.util.Properties;
import lombok.Data;
import org.apache.skywalking.oap.server.library.module.ModuleConfig;
+import java.util.Properties;
+
@Data
public class KafkaFetcherConfig extends ModuleConfig {
@@ -68,7 +69,7 @@ public class KafkaFetcherConfig extends ModuleConfig {
private boolean enableMeterSystem = false;
- private String configPath = "meter-receive-config";
+ private String configPath = "meter-analyzer-config";
private String topicNameOfMetrics = "skywalking-metrics";
diff --git a/oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/ResourceUtils.java b/oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/ResourceUtils.java
index a0fc0c244ef67961a4f8619fa398db8f92ed1a44..48e3d49e9d344e67ab51b73afb8e22e2164de4de 100644
--- a/oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/ResourceUtils.java
+++ b/oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/ResourceUtils.java
@@ -24,7 +24,10 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.Objects;
+import java.util.Set;
public class ResourceUtils {
@@ -47,4 +50,19 @@ public class ResourceUtils {
}
return Objects.requireNonNull(new File(url.getPath()).listFiles(), "No files in " + path);
}
+
+ public static File[] getPathFiles(String parentPath, String[] fileNames) throws FileNotFoundException {
+ URL url = ResourceUtils.class.getClassLoader().getResource(parentPath);
+ if (url == null) {
+ throw new FileNotFoundException("path not found: " + parentPath);
+ }
+ final Set nameSet = new HashSet<>(Arrays.asList(fileNames));
+ final File[] listFiles = Objects.requireNonNull(new File(url.getPath())
+ .listFiles((dir, name) -> nameSet.contains(name)), "No files in " + parentPath);
+
+ if (listFiles.length == 0) {
+ throw new FileNotFoundException("files not found:" + nameSet);
+ }
+ return listFiles;
+ }
}
diff --git a/oap-server/server-library/library-util/src/test/java/org/apache/skywalking/oap/server/library/util/ResourceUtilsTest.java b/oap-server/server-library/library-util/src/test/java/org/apache/skywalking/oap/server/library/util/ResourceUtilsTest.java
index 054a3660e120ca4b0908ee738812bd561890d5f9..0a3fef65315efcc99185ba396d9004413ccccb95 100644
--- a/oap-server/server-library/library-util/src/test/java/org/apache/skywalking/oap/server/library/util/ResourceUtilsTest.java
+++ b/oap-server/server-library/library-util/src/test/java/org/apache/skywalking/oap/server/library/util/ResourceUtilsTest.java
@@ -17,13 +17,32 @@
package org.apache.skywalking.oap.server.library.util;
-import java.io.FileNotFoundException;
+import org.junit.Assert;
import org.junit.Test;
+import java.io.File;
+import java.io.FileNotFoundException;
+
public class ResourceUtilsTest {
@Test(expected = FileNotFoundException.class)
public void shouldThrowWhenResourceNotFound() throws FileNotFoundException {
ResourceUtils.read("/not-existed");
}
+
+ @Test
+ public void testGetPathFilesSuccess() throws FileNotFoundException {
+ final File[] files = ResourceUtils.getPathFiles("testdata", new String[] {
+ "prometheus.txt"
+ });
+ Assert.assertNotNull(files);
+ Assert.assertEquals(1, files.length);
+ }
+
+ @Test(expected = FileNotFoundException.class)
+ public void testGetPathFilesNotFound() throws FileNotFoundException {
+ ResourceUtils.getPathFiles("testdata", new String[] {
+ "not-existed"
+ });
+ }
}
\ No newline at end of file
diff --git a/oap-server/server-receiver-plugin/skywalking-meter-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/meter/provider/config/MeterConfigsTest.java b/oap-server/server-receiver-plugin/skywalking-meter-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/meter/provider/config/MeterConfigsTest.java
index b4cfb0c47186b7a1098451332f6d2a24ebe709f7..9632d8601444dc1cff847e87dfe2726b8cf41938 100644
--- a/oap-server/server-receiver-plugin/skywalking-meter-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/meter/provider/config/MeterConfigsTest.java
+++ b/oap-server/server-receiver-plugin/skywalking-meter-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/meter/provider/config/MeterConfigsTest.java
@@ -29,11 +29,11 @@ import java.util.Arrays;
import java.util.List;
public class MeterConfigsTest {
- private static final String CONFIG_PATH = "meter-receive-config";
+ private static final String CONFIG_PATH = "meter-analyzer-config";
@Test
public void testLoadConfig() throws ModuleStartException {
- final List meterConfigs = MeterConfigs.loadConfig(CONFIG_PATH);
+ final List meterConfigs = MeterConfigs.loadConfig(CONFIG_PATH, new String[] {"config.yaml"});
Assert.assertEquals(3, meterConfigs.size());
diff --git a/oap-server/server-receiver-plugin/skywalking-meter-receiver-plugin/src/test/resources/meter-receive-config/config.yaml b/oap-server/server-receiver-plugin/skywalking-meter-receiver-plugin/src/test/resources/meter-analyzer-config/config.yaml
similarity index 100%
rename from oap-server/server-receiver-plugin/skywalking-meter-receiver-plugin/src/test/resources/meter-receive-config/config.yaml
rename to oap-server/server-receiver-plugin/skywalking-meter-receiver-plugin/src/test/resources/meter-analyzer-config/config.yaml
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 c3f22405238b7e5ce16744b1b2aad3881bfe5cce..34df799e0d2a5e834bd0e5d695a207d1cd690219 100644
--- a/test/e2e/e2e-test/docker/kafka/docker-compose.meter.yml
+++ b/test/e2e/e2e-test/docker/kafka/docker-compose.meter.yml
@@ -21,12 +21,12 @@ services:
file: ../base-compose.yml
service: oap
environment:
- SW_RECEIVER_METER: default
SW_KAFKA_FETCHER: default
SW_KAFKA_FETCHER_SERVERS: broker-a:9092,broker-b:9092
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
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 54c249c2bdbef5135ee03597cb379bb4d2c9e78c..1428528d8a1853e6a8af7a337421106aec974a45 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_RECEIVER_METER: default
+ SW_METER_ANALYZER_ACTIVE_FILES: spring-sleuth.yaml
extends:
file: ../base-compose.yml
service: oap