[ 
https://issues.apache.org/jira/browse/KAFKA-10217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17152030#comment-17152030
 ] 

Bruno Cadonna commented on KAFKA-10217:
---------------------------------------

If the goal of this ticket is to get rid of the casts of {{StreamsMetrics}} to 
{{StreamsMetricsImpl}} (i.e. getting rid of 
{{ProcessorContextUtils#getMetricsImpl()}}) I think moving 
{{nodeLevelSensor()}} and {{storeLevelSensor()}} to {{StreamsMetrics}} is not 
enough. Internally {{storeLevelTagMap()}} and {{nodeLevelTagMap()}} are also 
called on the {{StreamsMetricsImpl}} instance. One example can be found here:

https://github.com/apache/kafka/blob/ce939e9136b7a1ea5343d464b7660f905212c053/streams/src/main/java/org/apache/kafka/streams/processor/internals/metrics/ProcessorNodeMetrics.java#L414

I think, it would be fine to also move {{storeLevelTagMap()}} and 
{{nodeLevelTagMap()}} to {{StreamsMetrics}}. My biggest concern would be that 
users can overwrite built-in metrics, but AFAIS that is not possible. However, 
we should have tests to verify that.   

Maybe moving also {{storeLevelTagMap()}} and {{nodeLevelTagMap()}} to 
{{StreamsMetrics}} is still not enough to get rid of 
{{ProcessorContextUtils#getMetricsImpl()}}.

 

> Move nodeLevelSensor and storeLevelSensor methods from StreamsMetricsImpl to 
> StreamsMetrics
> -------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-10217
>                 URL: https://issues.apache.org/jira/browse/KAFKA-10217
>             Project: Kafka
>          Issue Type: Improvement
>          Components: streams
>            Reporter: John Roesler
>            Assignee: mohamed chebbi
>            Priority: Minor
>              Labels: kip-required, newbie
>
> 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`
> Note: this feature requires a KIP, but since the API is already 
> pre-determined, it should be uncontroversial. This improvement would be a 
> good opportunity for someone who wants to get an initial KIP under their belt.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to