Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add kafka-client-metrics.sh --block

...

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\..*'

 # Block metrics collection for a specific client instance
 $ kafka-client-metrics.sh --bootstrap-server $BROKERS \
	--add \
    --name 'Disabe_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
    --block   


As the assumption is that the number of CLIENT_METRICS configuration entries will be relatively small (<100), all brokers with a configured metrics plugin will monitor and cache the configuration entries for the CLIENT_METRICS resource type. 

...

Code Block
bash
bash
bin/kafka-client-metrics.sh [arguments] --bootstrap-server <brokers>

List configured metrics:
	--list
    [ --name <descriptive-config-name> ]

Add metrics:
	--add
    [ --name <descriptive-config-name> ]
	--metric <metric-prefix>..   # may repeat
	--interval-ms <interval>
    --match <selector=regex>  # optional, may repeat
    [ --block ]  # Disables all metrics subscriptions for matching client instances.

Delete metrics:
	--delete
    --name <descriptive-config-name>


Note: Internally, blocking is performed by setting the push interval to 0, which nulls all other matching subscriptions.


Example workflows

Example workflows showcasing how this feature may be used for proactive and reactive purposes.

...