diff --git a/apm-commons/apm-util/src/main/java/org/apache/skywalking/apm/util/StringFormatGroup.java b/apm-commons/apm-util/src/main/java/org/apache/skywalking/apm/util/StringFormatGroup.java
index 36d689b9f097cae593dc9fe5ebb08087b538487e..e2b7a4f71ad94121eaae512feed208ba1ef0c1d5 100644
--- a/apm-commons/apm-util/src/main/java/org/apache/skywalking/apm/util/StringFormatGroup.java
+++ b/apm-commons/apm-util/src/main/java/org/apache/skywalking/apm/util/StringFormatGroup.java
@@ -63,6 +63,12 @@ public class StringFormatGroup {
return new FormatResult(false, string);
}
+ @Override public String toString() {
+ return "StringFormatGroup{" +
+ "rules=" + rules +
+ '}';
+ }
+
public class FormatResult {
private boolean match;
private String name;
@@ -97,5 +103,12 @@ public class StringFormatGroup {
public Pattern getPattern() {
return pattern;
}
+
+ @Override public String toString() {
+ return "PatternRule{" +
+ "name='" + name + '\'' +
+ ", pattern=" + pattern +
+ '}';
+ }
}
}
diff --git a/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/EndpointNameFormater.java b/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/EndpointNameFormater.java
index 0b88705351191a068dcf5947cb524cf2ea1fd44c..0a6ff6e358cb95a383e8723e21b067c24ea487ea 100644
--- a/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/EndpointNameFormater.java
+++ b/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/EndpointNameFormater.java
@@ -46,18 +46,21 @@ public class EndpointNameFormater {
}
if (stream == null) {
- logger.info("endpoint_naming_rules.properties not found. No endpoint name setup.");
+ logger.info("endpoint_naming_rules.properties not found. No endpoint naming setup.");
} else {
properties.load(stream);
properties.forEach((key, value) -> {
endpointRule.addRule((String)key, (String)value);
+ logger.debug("endpoint naming rule of service {} found, name[{}] and rule[{}]", service, key, value);
});
}
} catch (IOException e) {
- logger.info("{}_endpoint_rules.properties not found. No endpoint name setup.", service);
+ logger.info("{}_endpoint_rules.properties not found. No endpoint naming setup.", service);
}
ALL_RULES.put(service, endpointRule);
+ logger.debug("endpoint naming rules of service {} added. {}", service, endpointRule);
+
}
public static StringFormatGroup.FormatResult format(String service, String endpointName) {
diff --git a/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/TelemetryDataDispatcher.java b/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/TelemetryDataDispatcher.java
index 06a59d3a2976600fc60c01d858adef0ee8adf311..4731d48f6f8f80bd5f755382b661fedaa567a62e 100644
--- a/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/TelemetryDataDispatcher.java
+++ b/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/TelemetryDataDispatcher.java
@@ -63,10 +63,16 @@ public class TelemetryDataDispatcher {
public static void preProcess(ServiceMeshMetric data) {
String service = data.getDestServiceId() == Const.NONE ? data.getDestServiceName() :
SERVICE_CACHE.get(data.getDestServiceId()).getName();
- StringFormatGroup.FormatResult formatResult = EndpointNameFormater.format(service, data.getEndpoint());
+ String endpointName = data.getEndpoint();
+ StringFormatGroup.FormatResult formatResult = EndpointNameFormater.format(service, endpointName);
if (formatResult.isMatch()) {
data = data.toBuilder().setEndpoint(formatResult.getName()).build();
}
+ if (logger.isDebugEnabled()) {
+ if (formatResult.isMatch()) {
+ logger.debug("Endpoint {} is renamed to {}", endpointName, data.getEndpoint());
+ }
+ }
ServiceMeshMetricDataDecorator decorator = new ServiceMeshMetricDataDecorator(data);
if (decorator.tryMetaDataRegister()) {
diff --git a/oap-server/server-starter/pom.xml b/oap-server/server-starter/pom.xml
index 5e1d5a6e82b7d6f5b30445853af9624c67fc1477..37c5330f679dc77bb50f3e9200802dd1cbb038a4 100644
--- a/oap-server/server-starter/pom.xml
+++ b/oap-server/server-starter/pom.xml
@@ -186,6 +186,7 @@
alarm-settings.yml
component-libraries.yml
datasource-settings.properties
+ endpoint_naming_rules.properties