Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Use separate configEntrys

...

Metrics subscriptions are configured through the standard Kafka Admin API configuration interface with the new resource-type CLIENT_METRICS, the resource-name is any string - it does not have significance to the metrics system other than to group metrics subscriptions in the configuration interface. The configuration entry value is a JSON document containing an array of prefix-matched metric names (is made up of the following ConfigEntry names:

  • metrics  - a comma-separated list of metric name prefixes, e.g.,

...

  • "client.producer.partition.

...

  • , client.io.wait". Whitespaces are ignored.
  • interval  - metrics push interval in milliseconds

...

  • . Defaults to 5 minutes if not specified.
  • match_<selector>  - Client matching selector that is evaluated as an anchored regexp (i.e., "something.*" is treated as "^something.*$")., may repeat for different  selectors. Any client that matches all of the match_..  selectors will be eligible for this metrics subscription. Initially supported selectors:
    • client_instance_id - CLIENT_INSTANCE_ID UUID string representation.
    • client_software_name  - client software implementation name.
    • client_software_version  - client software implementation version

The JSON format is:

Code Block
languagejs
{
   "metrics": [
      "<prefix-matched-metric-name>",
      ".."
   ],
   "interval": <push-interval-in-milliseconds>,
   "match": {  // ANDed list of matching criteria. Matches all clients if not included.
     "client_instance_id": "..", // regex
     "client_software_name": "..", // regex
     "client_software_version": ".." // regex
     ..
   }
}

The match section is optional and allows fine-grained control for which client instances should receive this metrics subscription.

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.

...

    • .


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’ \
	--createalter \
	--add-config '{ "metrics": ["metrics=[org.apache.kafka/client.producer.partition.queue."., org.apache.kafka/client.io.wait], "interval": 15000 }=15000,match_client_instance_id=b69cc35a-7a54-4790-aa69-cc2bd4ee4538'


Or using the dedicated tool (preferred):

...