Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The match section is optional and allows fine-grained control for which client instances should receive this metrics subscription. The matching selectors are ignored if the resource-name is non-empty.

The supported matching selectors are the same as the client resource labels and broker added labels as listed in the metrics chapter, e.g.: client_id, source_address, client_instance_id, client_software_name, etc.

The regexes are automatically anchored (i.e., "something.*" is treated as "^something.*$").


Example using the standard kafka-configs.sh tool:

Code Block
bash
bash
 $ kafka-configs.sh --bootstrap-server $BROKERS \
	--entity-type client_metrics \
	--entity-name ‘basic_producer_metrics’ \
	--create \
	--add-config '{ "metrics": ["org.apache.kafka/client.producer.partition.queue."], "interval": 15000 }'

...

Or using the dedicated tool (preferred):

Code Block
bash
bash
 # Subscription for a specific client instance id
 $ kafka-client-metrics.sh --bootstrap-server $BROKERS \
	--add \
    --name 'Troubleshoot_b69cc35a' \  # A descriptive name makes it easier to clean up old subscriptions.
	--match client_instance_id=b69cc35a-7a54-4790-aa69-cc2bd4ee4538 \  # Match this specific client instance
	--metric org.apache.kafka/client.producer.partition.queue. \  # prefix-match
    --metric org.apache.kafka/client.producer.partition.latency \
	--interval-ms 15000

 # Subscription for all kafka-python v1.2.* clients 
 # A unique name is automatically generated when --name is omitted.
 $ kafka-client-metrics.sh --bootstrap-server $BROKERS \
	--add \
	--metric org.apache.kafka/client.consumer. \  # prefix-match
	--interval-ms 60000
    --match 'client_software_name=kafka-python' \  # match kafka-python 1.2.*
    --match 'client_software_version=1\.2\..*'

...