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 f63764cd33 Fix the wrong default value of `k8sServiceNameRule` if it's 
not explicitly set (#11200)
f63764cd33 is described below

commit f63764cd33a5929b6178ef8644211408c7f2c53e
Author: kezhenxu94 <[email protected]>
AuthorDate: Wed Aug 9 15:01:46 2023 +0800

    Fix the wrong default value of `k8sServiceNameRule` if it's not explicitly 
set (#11200)
---
 docs/en/changes/changes.md                                           | 1 +
 .../oap/server/receiver/envoy/als/k8s/ServiceNameFormatter.java      | 2 +-
 .../oap/server/receiver/envoy/als/k8s/ServiceNameFormatterTest.java  | 5 +++++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index c2a2066994..0cce700028 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -70,6 +70,7 @@
 * Add `view_as_seq` function in MQE for listing metrics in the given 
prioritized sequence.
 * Apply MQE on Virtual-MQ layer UI-templates
 * Apply MQE on Infra-Linux layer UI-templates
+* Fix the wrong default value of `k8sServiceNameRule` if it's not explicitly 
set.
 
 #### UI
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/ServiceNameFormatter.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/ServiceNameFormatter.java
index 3709061130..e33ad2df2d 100644
--- 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/ServiceNameFormatter.java
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/ServiceNameFormatter.java
@@ -36,7 +36,7 @@ public class ServiceNameFormatter {
     private final StringBuffer serviceNamePattern;
 
     public ServiceNameFormatter(String rule) {
-        rule = StringUtils.defaultIfBlank(rule, 
"${pod.metadata.labels.(service.istio.io/canonical-name),pod.metadata.labels.(app.kubernetes.io/name),pod.metadata.labels.app)}");
+        rule = StringUtils.defaultIfBlank(rule, 
"${pod.metadata.labels.(service.istio.io/canonical-name),pod.metadata.labels.(app.kubernetes.io/name),pod.metadata.labels.app}");
 
         this.properties = new ArrayList<>();
         this.serviceNamePattern = new StringBuffer();
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/ServiceNameFormatterTest.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/ServiceNameFormatterTest.java
index 8856ffb0a7..913048af14 100644
--- 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/ServiceNameFormatterTest.java
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/ServiceNameFormatterTest.java
@@ -63,6 +63,11 @@ public class ServiceNameFormatterTest {
                 
"${pod.metadata.labels.NOT_EXISTS,pod.metadata.labels.(service.istio.io/canonical-name),pod.metadata.labels.app}",
                 ImmutableMap.of("service", service("Clash"), "pod", 
pod(of("app", "ClashX-alpha"))),
                 "ClashX-alpha"
+            ),
+            new Case(
+                
"${pod.metadata.labels.(service.istio.io/canonical-name),pod.metadata.labels.(app.kubernetes.io/name),pod.metadata.labels.app}",
+                ImmutableMap.of("service", service("Clash"), "pod", 
pod(of("app", "ClashX-alpha"))),
+                "ClashX-alpha"
             )
         };
     }

Reply via email to