Skip to content

Commit

Permalink
updated to snapshot version
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhrubajyoti Sadhu committed Aug 15, 2023
1 parent dfea44f commit 3d2630a
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ void setMeterRegistry(MeterRegistry meterRegistry) {

private void incrementWithTags(String metricName, String methodName) {
if (meterRegistry != null) {
Tag federationTag = Tag.of("federation_namespace", getMonitorMetastore());
Tag methodTag = Tag.of("method_name", methodName);
Iterable<Tag> tags = Tags.of(federationTag, methodTag);
Iterable<Tag> tags = getMetricsTags(methodName);
meterRegistry.counter(metricName, tags).increment();
}
}
Expand All @@ -102,9 +100,7 @@ private void increment(String metricName) {

private void submitWithTags(String metricName, long value, String methodName) {
if (meterRegistry != null) {
Tag federationTag = Tag.of("federation_namespace", getMonitorMetastore());
Tag methodTag = Tag.of("method_name", methodName);
Iterable<Tag> tags = Tags.of(federationTag).and(methodTag);
Iterable<Tag> tags = getMetricsTags(methodName);
meterRegistry.timer(metricName, tags).record(Duration.ofMillis(value));
}
}
Expand All @@ -120,6 +116,12 @@ private String buildNewMetricBasePath(ProceedingJoinPoint pjp) {
return new StringBuilder(className).toString();
}

private Tags getMetricsTags(String methodName) {
Tag federationTag = Tag.of("federation_namespace", getMonitorMetastore());
Tag methodTag = Tag.of("method_name", methodName);
return Tags.of(federationTag).and(methodTag);
}

private String getMethodName(ProceedingJoinPoint pjp) {
String methodName = clean(pjp.getSignature().getName());
return new StringBuilder(methodName).toString();
Expand Down

0 comments on commit 3d2630a

Please sign in to comment.