Skip to content

Conversation

emasab
Copy link
Contributor

@emasab emasab commented Jun 4, 2025

Closes #5103

Metrics aren't duplicated when multiple prefixes match them.
Fixed by keeping track of the metrics that already matched.

@Copilot Copilot AI review requested due to automatic review settings June 4, 2025 17:29
@emasab emasab requested a review from a team as a code owner June 4, 2025 17:29
@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses the duplicate metrics issue that arises when multiple prefixes match the same metric by tracking already matched metrics. Key changes include:

  • Adding a new unittest (unittest_telemetry) and updating the test mappings in rdunittest.c.
  • Updating the telemetry matching logic in rdkafka_telemetry.c to prevent multiple matches via a boolean array.
  • Documenting the changes in the CHANGELOG.md.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/rdunittest.c Updated unittest mappings and added unittest_telemetry for telemetry.
src/rdkafka_telemetry.c Implemented a boolean guard (is_metric_included) and added a new unit test.
CHANGELOG.md Documented feature release and telemetry fixes.
Comments suppressed due to low confidence (1)

src/rdkafka_telemetry.c:177

  • Verify that the size of is_metric_included is always sufficient to cover all indices up to metrics_cnt to prevent potential out-of-bounds access. Consider adding an assertion or comment clarifying the expected relationship between metrics_cnt and the array size.
rd_bool_t is_metric_included[RD_MAX((int)RD_KAFKA_TELEMETRY_PRODUCER_METRIC__CNT, (int)RD_KAFKA_TELEMETRY_CONSUMER_METRIC__CNT)] = {0};

@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_kip714_fix_duplicated_metrics branch from 560bfd3 to 4155dfd Compare June 4, 2025 17:30
@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_kip714_fix_duplicated_metrics branch from 4155dfd to 600806d Compare June 9, 2025 16:58
@emasab emasab merged commit 29500bc into master Jun 10, 2025
2 checks passed
@emasab emasab deleted the dev_kip714_fix_duplicated_metrics branch June 10, 2025 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[KIP-714] Duplicate metrics when multiple prefixes are matching
2 participants