...
Code Block |
---|
/**
* Encapsulates the client instance ids used for metrics collection by
* producers, consumers and admin clients used by Kafka Streams.
*/
public interface ClientInstanceIds {
/**
* Get the client instance id of the admin client
*
* @return the client instance id
*/
Uuid adminInstanceId();
/**
* Get the client instance ids of the consumers
*
* @return a map from thread key to client instance id
*/
Map<String, Uuid> consumerInstanceIds();
/**
* Get the client instance ids of the producers
*
* @return a map from thread key to client instance id
*/
Map<String, Uuid> producerInstanceIds();
} |
Finally, a new method is added to org.apache.kafka.clients.CommonClientConfigs
to return the ClientTelemetryReporter
if configured. This mirrors the similar metricsReporters()
methods in that class.
Code Block |
---|
|
public static Optional<ClientTelemetryReporter> telemetryReporter(String clientId, AbstractConfig config); |
Broker configuration
Configuration | Description | Values |
---|
telemetry.max.bytes | The maximum size (after compression if compression is used) of telemetry pushed from a client to the broker. | int, default: 1048576, valid values: [1,...] |
...
Code Block |
---|
This tool helps to manipulate and describe client metrics configurations.
Option Description
------ -----------
--alter Alter the configuration of the client
metrics resource.
--block Block metrics collection.
--bootstrap-server <String: server to REQUIRED: The Kafka server to connect to.
connect to>
--command-config <String: command Property file containing configs to be
config property file> passed to Admin Client.
--delete Delete the configuration of the client
metrics resource.
--describe List configurations for client metrics resources.
--generate-name Generate a UUID to use as the name.
--help Print usage information.
--interval The metrics push interval in milliseconds.
--match Matching selector ‘k1=v1,k2=v2’. The following
is a list of valid selector names:
client_instance_id
client_id
client_software_name
client_software_version
client_source_address
client_source_port
--metrics Telemetry metric name prefixes ‘m1,m2’.
--name <String> Name of client metrics configuration resource.
--version Display Kafka version. |
...
Code Block |
---|
|
$ kafka-client-metrics.sh --bootstrap-server $BROKERS --alter --name MYMETRIC \
--metrics org.apache.kafka.consumer. \
--interval 60000 \
--match "client_software_name=kafka_python,client_software_version=1\.2\..*"
$ kafka-configs.sh --bootstrap-server $BROKERS --alter --entity-type client-metrics --entity-name MYMETRICS \
--add-config "metrics=org.apache.kafka.consumer.,interval.ms=60000,match=[client_software_name=kafka.python,client_software_version=1\.2\..*]" |
Block an existing client metrics configuration resource from pushing metrics
Blocking pushing metrics for a client metrics configuration resource is achieved by setting the push interval to 0ms.
Code Block |
---|
|
$ kafka-client-metrics.sh --bootstrap-server $BROKERS --alter --name MYMETRICS --block
$ kafka-configs.sh --bootstrap-server $BROKERS --alter --entity-type client-metrics --entity-name MYMETRICS \
--add-config "interval.ms=0" |
Delete a client metrics configuration resource
...