You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2021/08/26 07:51:39 UTC

[skywalking] branch bugfix/config created (now ce21d33)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a change to branch bugfix/config
in repository https://gitbox.apache.org/repos/asf/skywalking.git.


      at ce21d33  Escape `.` in `String.replaceFirst` as it acts as a wildcard

This branch includes the following new commits:

     new ce21d33  Escape `.` in `String.replaceFirst` as it acts as a wildcard

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[skywalking] 01/01: Escape `.` in `String.replaceFirst` as it acts as a wildcard

Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch bugfix/config
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit ce21d335a430c17b3af7c96ff291a5c6fd28cd0e
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Thu Aug 26 15:37:10 2021 +0800

    Escape `.` in `String.replaceFirst` as it acts as a wildcard
---
 docs/en/setup/backend/backend-receivers.md           |  2 +-
 docs/en/setup/istio/README.md                        |  4 ++--
 .../ConfigmapConfigurationWatcherRegister.java       |  2 +-
 .../configmap/ConfigurationConfigmapInformer.java    | 20 ++++++++++++--------
 4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/docs/en/setup/backend/backend-receivers.md b/docs/en/setup/backend/backend-receivers.md
index c3e79a2..0e59e24 100644
--- a/docs/en/setup/backend/backend-receivers.md
+++ b/docs/en/setup/backend/backend-receivers.md
@@ -110,7 +110,7 @@ E.g. The `oc` handler loads rules from `$CLASSPATH/otel-oc-rules`.
 
 Supported handlers:
 
-* `oc`: [OpenCensus](https://github.com/open-telemetry/opentelemetry-collector/blob/master/exporter/opencensusexporter/README.md) gRPC service handler.
+* `oc`: [OpenCensus](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/a08903f05d3a544f548535c222b1c205b9f5a154/exporter/opencensusexporter/README.md) gRPC service handler.
 
 **Notice:**  Set `SW_OTEL_RECEIVER=default` through system environment or change `receiver-otel/selector=${SW_OTEL_RECEIVER:default}` to activate the OpenTelemetry receiver.
 
diff --git a/docs/en/setup/istio/README.md b/docs/en/setup/istio/README.md
index 63fb38d..74c2fe2 100644
--- a/docs/en/setup/istio/README.md
+++ b/docs/en/setup/istio/README.md
@@ -39,7 +39,7 @@ relabel_configs:
   replacement: <cluster name>
 ```
 
-or opt to [Resource Processor](https://github.com/open-telemetry/opentelemetry-collector/blob/master/processor/resourceprocessor/README.md):
+or opt to [Resource Processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/a08903f05d3a544f548535c222b1c205b9f5a154/processor/resourceprocessor/README.md):
 
 ```
 processors:
@@ -55,7 +55,7 @@ the issues described [here](https://github.com/open-telemetry/opentelemetry-coll
 Try to use the solution indicated in this issue if it's not fixed.
 
 #### OpenCensus exporter
-Follow [OpenCensus exporter configuration](https://github.com/open-telemetry/opentelemetry-collector/blob/master/exporter/opencensusexporter/README.md)
+Follow [OpenCensus exporter configuration](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/a08903f05d3a544f548535c222b1c205b9f5a154/exporter/opencensusexporter/README.md)
 to set up a connection between OpenTelemetry collector and OAP cluster. `endpoint` is the address of OAP gRPC service.
 
 ## Observe Istio
diff --git a/oap-server/server-configuration/configuration-k8s-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigmapConfigurationWatcherRegister.java b/oap-server/server-configuration/configuration-k8s-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigmapConfigurationWatcherRegister.java
index 7f34e7b..ca08957 100644
--- a/oap-server/server-configuration/configuration-k8s-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigmapConfigurationWatcherRegister.java
+++ b/oap-server/server-configuration/configuration-k8s-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigmapConfigurationWatcherRegister.java
@@ -60,7 +60,7 @@ public class ConfigmapConfigurationWatcherRegister extends ConfigWatcherRegister
             groupConfigTable.addGroupConfigItems(groupConfigItems);
             configMapData.forEach((groupItemKey, itemValue) -> {
                 if (groupItemKey.startsWith(key)) {
-                    String itemName = groupItemKey.replaceFirst(key + ".", "");
+                    String itemName = groupItemKey.replaceFirst(key + "\\.", "");
                     groupConfigItems.add(new ConfigTable.ConfigItem(itemName, itemValue));
                 }
             });
diff --git a/oap-server/server-configuration/configuration-k8s-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigurationConfigmapInformer.java b/oap-server/server-configuration/configuration-k8s-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigurationConfigmapInformer.java
index 15061d6..f95fc43 100644
--- a/oap-server/server-configuration/configuration-k8s-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigurationConfigmapInformer.java
+++ b/oap-server/server-configuration/configuration-k8s-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigurationConfigmapInformer.java
@@ -29,6 +29,7 @@ import io.kubernetes.client.openapi.models.V1ConfigMapList;
 import io.kubernetes.client.util.Config;
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.ExecutorService;
@@ -86,14 +87,17 @@ public class ConfigurationConfigmapInformer {
 
     public Map<String, String> configMapData() {
         Map<String, String> configMapData = new HashMap<>();
-        if (configMapLister != null && configMapLister.list() != null) {
-            configMapLister.list().forEach(cf -> {
-                Map<String, String> data = cf.getData();
-                if (data == null) {
-                    return;
-                }
-                configMapData.putAll(data);
-            });
+        if (configMapLister != null) {
+            final List<V1ConfigMap> list = configMapLister.list();
+            if (list != null) {
+                list.forEach(cf -> {
+                    Map<String, String> data = cf.getData();
+                    if (data == null) {
+                        return;
+                    }
+                    configMapData.putAll(data);
+                });
+            }
         }
 
         return configMapData;