Skip to content

debezium/dbz#2380 Export sink connector metrics with correct Prometheus labels - #301

Merged
vjuranek merged 1 commit into
debezium:mainfrom
wagnercsantos:dbz-2380-prometheus-sink-labels
Aug 20, 2026
Merged

debezium/dbz#2380 Export sink connector metrics with correct Prometheus labels#301
vjuranek merged 1 commit into
debezium:mainfrom
wagnercsantos:dbz-2380-prometheus-sink-labels

Conversation

@wagnercsantos

Copy link
Copy Markdown
Contributor

Fixes debezium/dbz#2380.

Sink connectors register their MXBeans as
debezium.<plugin>:type=connector-metrics,context=sink,server=<name>,task=<id>, an
ordering that none of the existing rules in metrics.yml matches: one expects server
before context, and the other has no task and captures server greedily up to >.
Only the latter matches a sink, so the task key ends up inside the name label and no
task label is produced.

Before:

debezium_metrics_TotalNumberOfWrites{context="sink",name="jdbc-sink, task=0",plugin="jdbc"} 42.0

After:

debezium_metrics_TotalNumberOfWrites{context="sink",name="jdbc-sink",plugin="jdbc",task="0"} 42.0

which is the label shape the source connectors already produce.

The change adds a single rule for the sink ordering, placed before the generic one so
that it takes precedence. Existing rules are untouched, so source connector series are
unaffected.

Verified by running Debezium Server with JMX_EXPORTER_PORT set and scraping /metrics
before and after, comparing a sink series against a source series in the same output:
the malformed name is corrected, a task label appears, and all counter values are
unchanged.

…us labels

Sink connectors register their MXBeans as
debezium.<plugin>:type=connector-metrics,context=sink,server=<name>,task=<id>,
an ordering that none of the existing rules in metrics.yml matches: one expects
server before context, and the other has no task and captures server greedily up
to '>'. As a result the task key ends up inside the name label, for example
name="jdbc-sink, task=0", and no task label is produced.

Add a rule for that ordering, before the generic one so that it takes precedence.
Sink metrics are then labelled like the source connectors already are, with the
connector name in name and the task id in its own label.

Signed-off-by: Wagner Santos <wagner.santos@databricks.com>
@wagnercsantos
wagnercsantos force-pushed the dbz-2380-prometheus-sink-labels branch from 2de577c to 9ed74a6 Compare August 19, 2026 22:03
@wagnercsantos

Copy link
Copy Markdown
Contributor Author

Hi @Naros — would you have a moment to review this one? It's a small fix (+8/−0 in metrics.yml): the Prometheus JMX exporter config wasn't capturing the context and task labels that the sink connector metrics expose, so those series landed without the labels needed to tell connectors apart. This adds the mapping rules for them.

The branch is rebased on current main with linear history, and it's CLEAN follow the same rule at #294. Happy to adjust anything.

@vjuranek vjuranek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vjuranek
vjuranek merged commit 75c01f3 into debezium:main Aug 20, 2026
6 checks passed
@vjuranek

Copy link
Copy Markdown
Member

Merged, thanks @wagnercsantos !

@wagnercsantos

Copy link
Copy Markdown
Contributor Author

tks @vjuranek!!!!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prometheus JMX Exporter mislabels sink connector metrics in Debezium Server

3 participants