sink: make sink statistics consistent and flush-aware
Open
@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_totalreports 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
typelabel 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.