pingcap / pingcap/ticdc

sink: make sink statistics consistent and flush-aware

Open
#5,820 0 comments 0 reactions 1 assignee View on GitHub

@3AceShowHand is already working on this.

Since Jul 29, 2026.

affects-8.5 component/metrics-logging type/enhancement
Dominant language
Go
Stars
56
Forks
63
Avg merge
2d 20h
Merged PRs (30d)
34

Description

What did you do?

Run changefeeds with different sink implementations and inspect the sink write-byte, batch-row, execution-error, and affected-row metrics.

What did you expect to see?

  • Sink statistics use the same label set across sink implementations.
  • ticdc_sink_write_bytes_total reports the original DML event bytes only after data is successfully flushed to the downstream.
  • MySQL affected-row statistics are updated only after the transaction commits successfully.
  • The statistics package owns its Prometheus collectors and exposes only construction and registration APIs.

What did you see instead?

  • Write bytes were derived from encoded or output payload sizes, so values differed by sink and protocol.
  • Kafka and Pulsar statistics could be updated before the asynchronous send callback confirmed completion.
  • MySQL affected rows could be recorded before commit and therefore include failed transactions.
  • The sink type label split statistics for the same changefeed into backend-specific series.
  • Statistics-owned collectors were exported from pkg/metrics, allowing callers outside the owning package to access internal metrics directly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.