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

wusheng pushed a commit to branch group-bugfix
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 60d4382a63c2be58d51d1e925a30fcb89b7ddec9
Author: Wu Sheng <wu.sh...@foxmail.com>
AuthorDate: Sat May 23 13:45:31 2020 +0800

    fix #4813
---
 .../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);
     }
 }

Reply via email to