strimzi / metrics-reporter

Prometheus Metrics Reporter for Apache Kafka server and client compoenents
Apache License 2.0
4 stars 7 forks source link

Add warning log when duplicate leables are created or detected #29

Closed OwenCorrigan76 closed 1 month ago

OwenCorrigan76 commented 2 months ago

The logic that handles non-numeric metrics is in the DataPointSnapshotBuilder class. Here is where a new label with a metric value is created. Currently we unconditionally add our new label without checking if a label with the same name exists already. This PR logs a warning if duplicate labes are detected rather than throwing an IllegalArgumentException

OwenCorrigan76 commented 2 months ago

@mimaison I've refactored the infoDataPoint to use the contains method. This takes care of the newly created labels right? Is it in gaugeDataPoint that I should handle already existing lables?

mimaison commented 2 months ago

@mimaison I've refactored the infoDataPoint to use the contains method. This takes care of the newly created labels right? Is it in gaugeDataPoint that I should handle already existing lables?

No, it's in the 2 places where we create Labels objects:

mimaison commented 2 months ago

@OwenCorrigan76 There's a checkstyle issue that's failing the build: https://dev.azure.com/cncf/strimzi/_build/results?buildId=174948&view=logs&j=441a6687-78c7-548e-9324-bade41cb68f6&t=cce61017-8585-548c-ef2e-c6a3bc420f66. Can you fix it? Thanks

OwenCorrigan76 commented 2 months ago

Sorry, didn't do a mvn compile .Fixing now.