Edoardo Comar created KAFKA-4605: ------------------------------------ Summary: MetricsRegistry during KafkaServerTestHarness polluted by side effects Key: KAFKA-4605 URL: https://issues.apache.org/jira/browse/KAFKA-4605 Project: Kafka Issue Type: Bug Components: unit tests Reporter: Edoardo Comar Priority: Minor
Components like KafkaController, ReplicaManager etc that extend KafkaMetricsGroup *apparently* create new metrics but the 'newGauge' method actually invokes 'MetricsRegistry.getOrAdd' so with multiple servers in the same JVM only the first server actually creates metrics. The side effects are 1) a test cannot fully check the metric - only the metric instance created by the first class that registered it 2) after a tearDown, the registry is still ful of metrics and a subsequent test will not instantiate new metrics We've been bitten by the issue in https://github.com/apache/kafka/pull/2325 -- This message was sent by Atlassian JIRA (v6.3.4#6332)