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

Ismael Juma commented on KAFKA-5244:
------------------------------------

Good find [~rsivaram]. Note that in https://github.com/apache/kafka/pull/2983, 
I changed `BrokerTopicStats` to be a class. The underlying metrics are still a 
singleton, but it means that we would recreate them on start-up of KafkaServer. 
Maybe that fixes this issue?

> Tests which delete singleton metrics break subsequent metrics tests
> -------------------------------------------------------------------
>
>                 Key: KAFKA-5244
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5244
>             Project: Kafka
>          Issue Type: Bug
>          Components: core
>            Reporter: Rajini Sivaram
>            Assignee: Rajini Sivaram
>             Fix For: 0.11.0.0
>
>
> Static metrics like {{BrokerTopicStats.ReplicationBytesInPerSec}} are created 
> in a singleton, resulting in one metric being created in a JVM. Some tests 
> like {{MetricsDuringTopicCreationDeletionTest}} delete all metrics from the 
> static metrics registry. The singleton metrics don't get recreated and 
> subsequent tests relying on these metrics may fail.
> Singleton metrics make testing hard - we have no idea what metrics are being 
> tested. Not sure we want to change that though since there is a lot of code 
> that relies on this. But we have to fix tests to ensure that metrics are left 
> in a good state.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to