Problem
Several metrics that only apply to the MySQL sink are defined and registered in pkg/metrics:
ExecDMLEventRowsAffectedCounter
ConflictDetectDuration
- the transaction worker metrics (
WorkerBatchFlushDuration, WorkerFlushDuration, WorkerTotalDuration, WorkerHandledRows, and WorkerEventRowCount)
ActiveActiveConflictSkipRowsCounter
Affected-row recording and cleanup are also implemented by the generic metrics.Statistics type, even though the value comes from sql.Result.RowsAffected() in the MySQL writer. This splits metric definition, recording, and lifecycle management across the generic metrics package and the MySQL sink.
Expected behavior
- Define and register MySQL-only collectors in the MySQL sink package.
- Record affected-row metrics in the MySQL writer, where
RowsAffected() is available.
- Manage affected-row series with the MySQL sink lifecycle.
- Keep
metrics.Statistics limited to metrics shared by sink implementations.
- Preserve the existing Prometheus metric names, labels, help text, and histogram buckets.
Problem
Several metrics that only apply to the MySQL sink are defined and registered in
pkg/metrics:ExecDMLEventRowsAffectedCounterConflictDetectDurationWorkerBatchFlushDuration,WorkerFlushDuration,WorkerTotalDuration,WorkerHandledRows, andWorkerEventRowCount)ActiveActiveConflictSkipRowsCounterAffected-row recording and cleanup are also implemented by the generic
metrics.Statisticstype, even though the value comes fromsql.Result.RowsAffected()in the MySQL writer. This splits metric definition, recording, and lifecycle management across the generic metrics package and the MySQL sink.Expected behavior
RowsAffected()is available.metrics.Statisticslimited to metrics shared by sink implementations.