Skip to content

Commit 2df92cf

Browse files
authored
Avoid needless re-registering Kafka metrics (#6068)
Functionally this does not cause any issue because calls to register after the first will not do anything, but it results in a warning in the log for Gauge re-registration, which can mask other issues.
1 parent eb93fc3 commit 2df92cf

File tree

1 file changed

+2
-3
lines changed
  • micrometer-core/src/main/java/io/micrometer/core/instrument/binder/kafka

1 file changed

+2
-3
lines changed

micrometer-core/src/main/java/io/micrometer/core/instrument/binder/kafka/KafkaMetrics.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,10 @@ void checkAndBindMetrics(MeterRegistry registry) {
218218
registeredMeterIds.remove(otherId);
219219
}
220220
// Check if already exists
221-
else if (tags.size() == meterTagsWithCommonTags.size())
221+
else if (tags.size() == meterTagsWithCommonTags.size()) {
222222
if (tags.containsAll(meterTagsWithCommonTags))
223223
return;
224-
else
225-
break;
224+
}
226225
else
227226
hasLessTags = true;
228227
}

0 commit comments

Comments
 (0)