From fed62aa73131aa6e2497baaad7abbb81943cf528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=99=9F=20Wu=20Sheng?= Date: Sat, 23 May 2020 14:55:43 +0800 Subject: [PATCH] Fix #4813 (#4815) --- .../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 928f46125..3474b78e7 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); } } -- GitLab