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 2020/05/23 06:55:55 UTC

[skywalking] branch master updated: Fix #4813 (#4815)

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

kezhenxu94 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 fed62aa  Fix #4813 (#4815)
fed62aa is described below

commit fed62aa73131aa6e2497baaad7abbb81943cf528
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Sat May 23 14:55:43 2020 +0800

    Fix #4813 (#4815)
---
 .../skywalking/oap/server/core/config/NamingControl.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/config/NamingControl.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/config/NamingControl.java
index 928f461..3474b78 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/config/NamingControl.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/config/NamingControl.java
@@ -86,28 +86,28 @@ public class NamingControl implements Service {
     }
 
     /**
-     * Format endpoint name by using the length config in the core module. This is a global rule, every place including
-     * endpoint as the {@link org.apache.skywalking.oap.server.core.source.Source} should follow this for any core
-     * module implementation.
+     * Format endpoint name by using the length config in the core module. This is a global rule, every {@link
+     * org.apache.skywalking.oap.server.core.source.Source} including endpoint should follow this for any core module
+     * implementation.
      *
      * @param serviceName  the service of the given endpoint.
      * @param endpointName raw data, literal string.
      * @return the string, which length less than or equals {@link #endpointNameMaxLength};
      */
     public String formatEndpointName(String serviceName, String endpointName) {
+        String lengthControlledName = endpointName;
         if (endpointName.length() > endpointNameMaxLength) {
-            final String rename = endpointName.substring(0, endpointNameMaxLength);
+            lengthControlledName = endpointName.substring(0, endpointNameMaxLength);
             if (log.isDebugEnabled()) {
                 log.debug(
                     "Endpoint {} has been renamed to {} due to length limitation {}",
                     endpointName,
-                    rename,
+                    lengthControlledName,
                     serviceNameMaxLength
                 );
             }
-            return endpointNameGrouping.format(serviceName, rename);
-        } else {
-            return endpointName;
+
         }
+        return endpointNameGrouping.format(serviceName, lengthControlledName);
     }
 }