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

Chris Egerton commented on KAFKA-9977:
--------------------------------------

Thanks [~tharindu]. It looks like this is happening because the 
[ErrorHandlingMetrics|https://github.com/apache/kafka/blob/9bc96d54f8953d190a1fb6478a0656f049ee3b32/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/errors/ErrorHandlingMetrics.java]
 instances that the worker [creates for each 
task|https://github.com/apache/kafka/blob/9bc96d54f8953d190a1fb6478a0656f049ee3b32/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Worker.java#L505]
 are never de-allocated (and don't even have logic for being deallocated if the 
worker wanted to).

There's nothing concrete in 
[KIP-298|https://cwiki.apache.org/confluence/display/KAFKA/KIP-298%3A+Error+Handling+in+Connect]
 about whether the lifetimes of these metrics should be linked to the lifetimes 
of their tasks. I think it makes sense to remove them when the tasks are 
deleted. There's a small chance that we might break existing tooling if we do 
that now, since someone may be relying on the presence of these metrics even 
after their connector is deleted, but collecting and exposing metrics on 
deleted tasks presents a risk too that users like yourself will believe that 
those tasks still exist.

Don't have time to implement a fix for this myself right now, but if you're 
feeling up to it, PRs are always welcome :)

> Kafka Connect Task level error metrics exposed via JMX not removed on 
> connector delete
> --------------------------------------------------------------------------------------
>
>                 Key: KAFKA-9977
>                 URL: https://issues.apache.org/jira/browse/KAFKA-9977
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>    Affects Versions: 2.3.1
>            Reporter: Tharindu
>            Priority: Major
>              Labels: metrics
>
> When collecting metrics at a task level exposed via JMX it was noticed that 
> task level metrics reported under 
> *_kafka.connect:type=task-error-metrics,connector="\{connector}",task="\{task}"_*
> were not being removed on connector deletion resulting in us collecting 
> metrics for tasks no longer active. 
> In the source code I could not find a point where these metrics were cleaned 
> up. 



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

Reply via email to