mjsax commented on code in PR #20633:
URL: https://github.com/apache/kafka/pull/20633#discussion_r2400950126
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/metrics/StreamsMetricsImpl.java:
##########
@@ -335,8 +335,15 @@ public final void removeAllThreadLevelMetrics(final String
threadId) {
}
}
- public void removeMetric(final MetricName metricName) {
+ public void removeStoreLevelMetric(final MetricName metricName) {
metrics.removeMetric(metricName);
+ storeLevelMetrics.get(
+ storeSensorPrefix(
+ metricName.tags().get("thread-id"),
+ metricName.tags().get("task-id"),
+ metricName.tags().get("scope-state-id")
+ )
+ ).remove(metricName);
Review Comment:
This is the actual fix. When we call
`StateStoreMetrics.addOldestOpenIteratorGauge()` (inside
`OpenIterators.add(...)`) to the add the metric, we not only add an entry to
`metrics`, but also to `storeLevelMetrics`.
We forgot to remove the second entry...
I am not 100% sure, given the "fancy" code how we add the metric, if this
removal code is 100% correct, because adding metrics is implemented in an
idempotent way. -- I believe it's ok, but please don't take it for granted, and
verify if this is right, or not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]