Move nodeLevelSensor and storeLevelSensor methods from StreamsMetricsImpl to StreamsMetrics
Status
Current state: Under Discussion
Discussion thread: [DISCUSS] KIP-639 Move nodeLevelSensor and storeLevelSensor methods from StreamsMetricsImpl to StreamsMetrics
JIRA: KAFKA-10217
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Motivation
StreamsMetricsImpl contains several convenience methods for safely registering sensors at different levels of granularity. We added them as internal methods because we weren't sure of their stability and utility. Now, they've been in use for quite a while and seem to be stable.
We should move them up into the public API so that custom stores and processor implementations can also benefit from their safety.
Implementing this feature should also allow us to drop the adaptor function: `org.apache.kafka.streams.processor.internals.ProcessorContextUtils#getMetricsImpl`
Public Interfaces
Add four methods to `StreamsMetrics`.
// New Method Sensor nodeLevelSensor(final String threadId, final String taskId, final String processorNodeName, final String sensorName, final Sensor.RecordingLevel recordingLevel, final Sensor... parents); // New Method Sensor storeLevelSensor(final String threadId, final String taskId, final String storeName, final String sensorName, final Sensor.RecordingLevel recordingLevel, final Sensor... parents); // New Method Map<String, String> nodeLevelTagMap(final String threadId, final String taskName, final String processorNodeName); // New Method Map<String, String> storeLevelTagMap(final String threadId, final String taskName, final String storeType, final String storeName);
Proposed Changes
Move nodeLevelSensor and storeLevelSensor methods from StreamsMetricsImpl to StreamsMetrics.
drop the adaptor function: `org.apache.kafka.streams.processor.internals.ProcessorContextUtils#getMetricsImpl`
Compatibility, Deprecation, and Migration Plan
Nothing to do.