diff --git a/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/metrics/MonitoredAspect.java b/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/metrics/MonitoredAspect.java index e61d9a4b7..5b8d76ffa 100644 --- a/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/metrics/MonitoredAspect.java +++ b/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/metrics/MonitoredAspect.java @@ -53,7 +53,7 @@ public Object monitor(ProceedingJoinPoint pjp) throws Throwable { public Object monitor(ProceedingJoinPoint pjp, Monitored monitored) throws Throwable { String metricBasePath = buildMetricBasePath(pjp); - String metricWithTagBasePath = buildMetricWithTagsBasePath(pjp); + String className = getClassName(pjp); String methodName = getMethodName(pjp); String result = null; @@ -73,9 +73,9 @@ public Object monitor(ProceedingJoinPoint pjp, Monitored monitored) throws Throw stopwatch.elapsed(TimeUnit.MILLISECONDS)); // Sends metrics with Tags: federation_namespace and method_name - incrementWithTags(buildMetricPath(COUNTER, metricWithTagBasePath, "calls"), methodName); - incrementWithTags(buildMetricPath(COUNTER, metricWithTagBasePath, result), methodName); - submitWithTags(buildMetricPath(TIMER, metricWithTagBasePath, "duration"), + incrementWithTags(buildMetricPath(COUNTER, className, "calls"), methodName); + incrementWithTags(buildMetricPath(COUNTER, className, result), methodName); + submitWithTags(buildMetricPath(TIMER, className, "duration"), stopwatch.elapsed(TimeUnit.MILLISECONDS), methodName); } } @@ -118,13 +118,11 @@ private Tags getMetricsTags(String methodName) { } private String getMethodName(ProceedingJoinPoint pjp) { - String methodName = clean(pjp.getSignature().getName()); - return new StringBuilder(methodName).toString(); + return clean(pjp.getSignature().getName()); } private String getClassName(ProceedingJoinPoint pjp) { - String className = clean(pjp.getSignature().getDeclaringTypeName()); - return new StringBuilder(className).toString(); + return clean(pjp.getSignature().getDeclaringTypeName()); } private String buildMetricWithTagsBasePath(ProceedingJoinPoint pjp) {