Skip to content

Commit

Permalink
Added prometheus dependency to send metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhrubajyoti Sadhu committed Aug 16, 2023
1 parent 3ff30e4 commit a33c372
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 newMetricBasePath = buildMetricWithTagsBasePath(pjp);
String metricWithTagBasePath = buildMetricWithTagsBasePath(pjp);
String methodName = getMethodName(pjp);

String result = null;
Expand All @@ -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, newMetricBasePath, "calls"), methodName);
incrementWithTags(buildMetricPath(COUNTER, newMetricBasePath, result), methodName);
submitWithTags(buildMetricPath(TIMER, newMetricBasePath, "duration"),
incrementWithTags(buildMetricPath(COUNTER, metricWithTagBasePath, "calls"), methodName);
incrementWithTags(buildMetricPath(COUNTER, metricWithTagBasePath, result), methodName);
submitWithTags(buildMetricPath(TIMER, metricWithTagBasePath, "duration"),
stopwatch.elapsed(TimeUnit.MILLISECONDS), methodName);
}
}
Expand Down

0 comments on commit a33c372

Please sign in to comment.