Skip to content

Commit

Permalink
Try to create meters that have the same name but different sets of ta…
Browse files Browse the repository at this point in the history
…gs to reproduce the issue

See micrometer-metrics/micrometer#2426
  • Loading branch information
izeye committed Feb 8, 2021
1 parent 8c3acdc commit 7ca127a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/main/java/com/izeye/sample/TestRunner.java
Expand Up @@ -25,11 +25,20 @@ public TestRunner(MeterRegistry meterRegistry) {

@Override
public void run(ApplicationArguments args) {
createExecutor("another.executor.service", Tags.of("key1", "value1"));

for (int i = 0; i < 10; i++) {
ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(10);
new ExecutorServiceMetrics(scheduledThreadPoolExecutor, "my.executor.service." + i, Tags.empty())
.bindTo(this.meterRegistry);
String executorServiceName = "my.executor.service." + i;
Tags tags = Tags.empty();

createExecutor(executorServiceName, tags);
}
}

private void createExecutor(String executorServiceName, Tags tags) {
ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(10);
new ExecutorServiceMetrics(scheduledThreadPoolExecutor, executorServiceName, tags)
.bindTo(this.meterRegistry);
}

}

0 comments on commit 7ca127a

Please sign in to comment.