rodesai commented on a change in pull request #11149: URL: https://github.com/apache/kafka/pull/11149#discussion_r691767731
########## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/metrics/StreamsMetricsImpl.java ########## @@ -200,6 +201,30 @@ public RocksDBMetricsRecordingTrigger rocksDBMetricsRecordingTrigger() { } } + public <T> void addThreadLevelImmutableMetric(final String name, + final String description, + final String threadId, + final T value) { + final MetricName metricName = metrics.metricName( + name, THREAD_LEVEL_GROUP, description, threadLevelTagMap(threadId)); + synchronized (threadLevelMetrics) { Review comment: Ah I wasn't aware of the external vs internal sensor names. Now that I read through this again it seems to be that some external caller with a reference to `StreamsMetrics` can add their own sensors, which don't get cleaned up when the thread goes away. In this case we don't have external callers adding any thread-level metrics to the map, so we don't really need the prefix. Happy to include it to keep things consistent. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org