DSMON-1102: Add kafka_cluster_id tag to Kafka cluster metrics #21687
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds the
kafka_cluster_iddynamic tag to all Kafka broker metrics collected by the Kafka integration. The tag is dynamically populated from the JMX beankafka.server:type=KafkaServer,name=ClusterIdand is added to metrics from the Kafka brokers.Consumer and producer metrics are intentionally excluded from this change as they don't represent broker-level metrics.
Motivation
The Kafka cluster ID is a unique identifier for each Kafka cluster that is essential for building reliable observability features. By tagging all broker metrics with the cluster ID, we enable:
Cluster discovery: Automatically getting a comprehensive list of all monitored Kafka clusters
Data correlation: Linking Kafka broker metrics with Data Streams metrics for end-to-end observability
Multi-cluster environments: Better differentiation and filtering of metrics in environments with multiple Kafka clusters
This change is made possible by the dynamic tags functionality added in DataDog/jmxfetch#581, which allows us to dynamically fetch tag values from JMX beans and apply them to metrics at collection time.
Review checklist (to be filled by reviewers)
qa/skip-qalabel if the PR doesn't need to be tested during QA.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged