Skip to content

mysql: move MySQL-only metrics out of the generic metrics package #5867

Description

@3AceShowHand

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions