Kafkametrics Receiver
contrib
Maintainers: @dmitryax
Source: opentelemetry-collector-contrib
Supported Telemetry
Overview
Prerequisites
This receiver supports Kafka versions:- 2.X
- 3.X
Feature gates
See documentation.md for the complete list of feature gates supported by this processor. Feature gates can be enabled using the--feature-gates flag:
Getting Started
[!NOTE] You can opt out of using theRequired settings (no defaults):franz-goclient by disabling the feature gatereceiver.kafkametricsreceiver.UseFranzGowhen you run the OpenTelemetry Collector. See the following page for more details: Feature Gates
scrapers: any combination of the following scrapers can be enabled.topicsconsumersbrokers
cluster_alias: Alias name of the cluster. Addskafka.cluster.aliasresource attribute.protocol_version(default = 2.1.0): Kafka protocol versionbrokers(default = localhost:9092): the list of brokers to read from.resolve_canonical_bootstrap_servers_only(default = false): whether to resolve then reverse-lookup broker IPs during startup.topic_match(default = ^[^_].*$): regex pattern of topics to filter on metrics collection. The default filter excludes internal topics (starting with_).group_match(default = .*): regex pattern of consumer groups to filter on for metrics.client_id(default = otel-collector): consumer client idcollection_interval(default = 1m): frequency of metric collection/scraping.initial_delay(default =1s): defines how long this receiver waits before starting.tls: see TLS Configuration Settings for the full set of available options.auth(default none)plain_text(Deprecated in v0.123.0: use sasl with mechanism set to PLAIN instead.)username: The username to use.password: The password to use
saslusername: The username to use.password: The password to use.mechanism: The sasl mechanism to use (SCRAM-SHA-256, SCRAM-SHA-512, AWS_MSK_IAM_OAUTHBEARER, or PLAIN)aws_mskregion: AWS Region in case of AWS_MSK_IAM_OAUTHBEARER mechanism
tls((Deprecated in v0.124.0: configure tls at the top level): this is an alias for tls at the top level.kerberosservice_name: Kerberos service namerealm: Kerberos realmuse_keytab: Use of keytab instead of password, if this is true, keytab file will be used instead of passwordusername: The Kerberos username used for authenticate with KDCpassword: The Kerberos password used for authenticate with KDCconfig_file: Path to Kerberos configuration. i.e /etc/krb5.confkeytab_file: Path to keytab file. i.e /etc/security/kafka.keytabdisable_fast_negotiation: Disable PA-FX-FAST negotiation (Pre-Authentication Framework - Fast). Some common Kerberos implementations do not support PA-FX-FAST negotiation. This is set tofalseby default.
metadatafull(default = true): Whether to maintain a full set of metadata. When disabled, the client does not make the initial request to broker at the startup.retrymax(default = 3): The number of retries to get metadatabackoff(default = 250ms): How long to wait between metadata retries
Examples:
- Basic configuration with all scrapers:
- Configuration with more optional settings:
- A non-default broker is specified
- cluster alias is set to βkafka-prodβ
- collection interval is 5 secs.
- Kafka protocol version is 3.0.0
- mTLS is configured
Metrics
| Metric Name | Description | Unit | Type | Attributes |
|---|---|---|---|---|
β kafka.broker.log_retention_period | log retention time (s) of a broker. | s | Gauge | broker |
β
kafka.brokers | Number of brokers in the cluster. | {brokers} | UpDownCounter | |
β
kafka.consumer_group.lag | Current approximate lag of consumer group at partition of topic | 1 | Gauge | group, topic, partition |
β
kafka.consumer_group.lag_sum | Current approximate sum of consumer group lag across all partitions of topic | 1 | Gauge | group, topic |
β
kafka.consumer_group.members | Count of members in the consumer group | {members} | UpDownCounter | group |
β
kafka.consumer_group.offset | Current offset of the consumer group at partition of topic | 1 | Gauge | group, topic, partition |
β
kafka.consumer_group.offset_sum | Sum of consumer group offset across partitions of topic | 1 | Gauge | group, topic |
β
kafka.partition.current_offset | Current offset of partition of topic. | 1 | Gauge | topic, partition |
β
kafka.partition.oldest_offset | Oldest offset of partition of topic | 1 | Gauge | topic, partition |
β
kafka.partition.replicas | Number of replicas for partition of topic | {replicas} | UpDownCounter | topic, partition |
β
kafka.partition.replicas_in_sync | Number of synchronized replicas of partition | {replicas} | UpDownCounter | topic, partition |
β kafka.topic.log_retention_period | log retention period of a topic (s). | s | Gauge | topic |
β kafka.topic.log_retention_size | log retention size of a topic in Bytes, The value (-1) indicates infinite size. | By | Gauge | topic |
β kafka.topic.min_insync_replicas | minimum in-sync replicas of a topic. | {replicas} | Gauge | topic |
β
kafka.topic.partitions | Number of partitions in topic. | {partitions} | UpDownCounter | topic |
β kafka.topic.replication_factor | replication factor of a topic. | 1 | Gauge | topic |
Attributes
| Attribute Name | Description | Type | Values |
|---|---|---|---|
broker | The ID of the kafka broker | string | |
group | The ID (string) of a consumer group | string | |
partition | The number (integer) of the partition | int | |
topic | The ID (integer) of a topic | string |
Resource Attributes
| Attribute Name | Description | Type | Enabled |
|---|---|---|---|
kafka.cluster.alias | The alias name (string) of the cluster | string | β |
Configuration
Example Configuration
Last generated: 2026-04-13