Observability
Metrics prefixes and exporter configuration.
To operate a replication pipeline, we need to know whether it is keeping up, which partitions are assigned, and when something fails. Kafka exposes broker metrics but not replication-specific signals, therefore K2K exports replication and JVM metrics through Kafka (for Lenses HQ), OTLP, and Prometheus.
Enable export with the --telemetry flag and standard OTEL_* environment variables; see Command-line options. Customize name prefixes under metrics.prefix. For the metrics control topic, see Topic creation. Record lineage headers are separate; see Record tracing. For the Kafka metrics topic name, see the Advanced section below.
Prerequisites
At least one metrics exporter configured (Kafka with Lenses HQ, OTLP, or Prometheus)
Example
name: "my_pipeline"
source:
kafka:
common:
"bootstrap.servers": "source:9092"
consumer:
"group.id": "my-k2k-group"
target:
kafka:
common:
"bootstrap.servers": "target:9092"
metrics:
prefix:
assignment: "myapp.k2k."
replication:
- source:
topic: "orders.*"
- sink:
topic: source
partition: sourceConfiguration keys
Each prefix is prepended to the metrics emitted by one Kafka client or subsystem. Defaults differ per application — the offset mapper ships its own set, so the same key resolves differently depending on which application reads the pipeline.
metrics.prefix.sourceConsumer
Metric prefix for the source consumer
No
k2k.consumer.source.
(not used)
metrics.prefix.targetConsumer
Metric prefix for the target control consumer
No
k2k.consumer.control.
k2k.offsetmapping.consumer.control.
metrics.prefix.targetProducer
Metric prefix for the target producer
No
k2k.producer.
k2k.offsetmapping.producer.
metrics.prefix.assignment
Metric prefix for assignment metrics
No
k2k.
(not used)
metrics.prefix.offsetMappingApp
Metric prefix for offset mapper metrics
No
(not used)
k2k.offsetmapping.
When building dashboards or alerts across both applications, query the offset mapper under its k2k.offsetmapping. prefixes rather than the replicator defaults.
Metric names
K2K metrics
K2K emits these replication metrics under the metrics.prefix.assignment prefix (default k2k., so the full name of the first is k2k.topics-assigned):
topics-assigned
Source topics currently assigned to this instance
partitions-assigned
Source partitions currently assigned to this instance
offset-commit
Replication progress commits recorded in control topics
Use partitions-assigned to confirm work is spread across instances — see Horizontal scaling.
Tags
K2K metrics carry these tags:
source_topic
Topic name on the source Kafka cluster
source_partition
Partition number on the source Kafka cluster
target_topic
Topic name on the target Kafka cluster
target_partition
Partition number on the target Kafka cluster
Kafka client metrics passed through from the consumer, producer, and admin clients keep their standard Kafka names (records-lag, records-consumed-rate, record-send-rate, and so on) under the matching prefix, tagged with topic and partition. For their meaning, see the Apache Kafka monitoring reference.
JVM and runtime metrics are exported by the OpenTelemetry runtime instrumentation under their standard names.
Advanced
Kafka metrics topic
When using the Kafka metrics exporter with Lenses HQ, metrics are written to a control topic on the target Kafka cluster.
metrics.kafka.topic
Topic for Kafka metrics export
No
__k2k_metrics
Replicator
For auto creating this topic with custom settings, see Topic creation.
Last updated
Was this helpful?

