...
As metric names and labels are highly repetative it repetitive it is recommended that the serialized metrics are compressed prior to sending them to the broker if the serialized uncompressed size exceeds 1000 bytes.
...
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 is made up of the following ConfigEntry names:
name
- Optional human-readable name of the metric subscription. If one is not provided by the user, the admin client will first auto-generate a type-4 UUID to be used as the name before sending the request to the broker.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.*$"). Any client that matches all of thematch_..
selectors will be eligible for this metrics subscription. Initially supported selectors:client_instance_id
- CLIENT_INSTANCE_ID UUID string representation.client_id
- client's reported client.id in the GetTelemetrySubscriptionsRequest.client_software_name
- client software implementation name.client_software_version
- client software implementation version.client_source_address
- client connection's source address from the broker's point of view.client_source_port
- client connection's source port from the broker's point of view.
...
See the Private metrics chapter above for privacy/integrity.
Tools
kafka-client-metrics.sh
is a wrapper tool around kafka-configs.sh
that makes it easier to set up metric subscriptions.
...
Code Block | ||||
---|---|---|---|---|
| ||||
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 Delete metrics: --delete --name <descriptive-config-name> |
...