Skip to content

kafka: fix metrics - #5873

Closed
3AceShowHand wants to merge 2 commits into
pingcap:masterfrom
3AceShowHand:kafka-metrics-fix
Closed

kafka: fix metrics#5873
3AceShowHand wants to merge 2 commits into
pingcap:masterfrom
3AceShowHand:kafka-metrics-fix

Conversation

@3AceShowHand

@3AceShowHand 3AceShowHand commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: close #xxx

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

Summary by CodeRabbit

  • Refactor
    • Simplified checkpoint delivery processing across cloud storage, Kafka, and Pulsar sinks.
    • Removed checkpoint message count and duration metrics.
    • Streamlined message queue and sink monitoring while preserving checkpoint encoding, publishing, and delivery behavior.
    • Internal Kafka metric visibility was reduced without changing broker metric values, labels, collection, or cleanup behavior.

@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Aug 4, 2026
@ti-chi-bot

ti-chi-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign flowbehappy for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bfb2b90a-826f-4b9a-9ab2-cdb0d16085df

📥 Commits

Reviewing files that changed from the base of the PR and between 918306c and 617db02.

📒 Files selected for processing (2)
  • pkg/sink/kafka/metrics.go
  • pkg/sink/kafka/metrics_collector.go

📝 Walkthrough

Walkthrough

The change removes checkpoint message metrics from cloud storage, Kafka, and Pulsar sinks. It removes unused MQ metric definitions and registrations. It also makes Kafka broker metric gauges package-private while preserving their collection and cleanup behavior.

Changes

Sink metric cleanup

Layer / File(s) Summary
Remove metric definitions and registry wiring
pkg/metrics/sink.go, downstreamadapter/sink/metrics/mq.go
Removed checkpoint metric declarations, registrations, and unused MQ metric definitions. InitMQMetrics retains synchronized registry storage.
Remove checkpoint instrumentation
downstreamadapter/sink/cloudstorage/sink.go, downstreamadapter/sink/kafka/sink.go, downstreamadapter/sink/pulsar/sink.go
Removed checkpoint metric initialization, timing, label cleanup, count updates, and duration observations. Checkpoint encoding and delivery remain unchanged.
Restrict Kafka metric visibility
pkg/sink/kafka/metrics.go, pkg/sink/kafka/metrics_collector.go
Renamed Kafka broker metric gauges to package-private identifiers. Registration, collection, labels, and cleanup remain unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • pingcap/ticdc#5801: Continues the sink statistics refactor by removing obsolete metric definitions and usages.
  • pingcap/ticdc#5866: Refactors sink-specific Prometheus metrics in related code paths.

Suggested reviewers: hongyunyan, wk989898

Poem

A rabbit trimmed metrics from the trail,
Removed old counters from each sail.
Kafka gauges now hide from view,
Checkpoints still reach their destination true.
The registry stays locked; hops continue.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description retains the unfilled template and provides no problem statement, implementation details, testing information, impact assessment, or release note. Complete each required section, replace the placeholder issue reference, document testing and impact, and add a release note or None.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Kafka metrics change addressed by the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ti-chi-bot

ti-chi-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456.

📖 For more info, you can check the "Contribute Code" section in the development guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant