Skip to content

Commit

Permalink
Format Source Name
Browse files Browse the repository at this point in the history
  • Loading branch information
raynigon committed Nov 7, 2022
1 parent 9ae5993 commit 432706d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class DefaultAsyncService implements AsyncService {

@Override
public <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier) {
String sourceName = supplier.getClass().getName();
String sourceName = formatSource(supplier.getClass());
Timer queueTimer = meterRegistry.timer(QUEUE_TIMER_NAME, "source", sourceName);
Timer execTimer = meterRegistry.timer(EXECUTION_TIMER_NAME, "source", sourceName);
Timer.Sample sample = Timer.start();
Expand All @@ -43,7 +43,7 @@ public <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier) {

@Override
public <V> ForkJoinTask<V> submit(Callable<V> callable) {
String sourceName = callable.getClass().getName();
String sourceName = formatSource(callable.getClass());
Timer queueTimer = meterRegistry.timer(QUEUE_TIMER_NAME, "source", sourceName);
Timer execTimer = meterRegistry.timer(EXECUTION_TIMER_NAME, "source", sourceName);
Timer.Sample sample = Timer.start();
Expand All @@ -54,4 +54,8 @@ public <V> ForkJoinTask<V> submit(Callable<V> callable) {
};
return forkJoinPool.submit(wrapped);
}

private String formatSource(Class<?> source){
return source.getName().split("/")[0];
}
}

0 comments on commit 432706d

Please sign in to comment.