Versions Compared

Key

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

Table of Contents

Status

Current state: Under Discussion Accepted

Discussion thread: here 

JIRA: here

...

Motivation

With the delivery of KIP-714, cluster operators can now pull metrics from a broker (sent by clients) via a plugin. KIP KIP-714 dramatically simplifies observing client behavior via metrics.  Still, it only accounts for metrics from clients (admin, consumer, and producer), leaving out applications that embed client instances, such as Kafka Streams. While the importance of capturing client metrics is evident, there should be a mechanism for capturing the enclosing application metrics, as reviewing both sets will be required to get a complete performance picture. This proposal aims to provide a mechanism for applications containing Kafka clients to supplement the client metrics with some application-specific metrics.

...

In this KIP, we propose to add a two new method methods to the Admin, Consumer, and Producer  interfaces. The KafkaAdminClient, KafkaConsumer, and KafkaProducer  will implement this new methodmethods.

Proposed Changes

The method registerMetricsForSubscriptionmethods registerMetricForSubscription and ungregisterMetricFromSubscription  will be added to the Admin, Consumer,  and Producer  interfaces. Because of the ad hoc connections of the AdminClient this KIP will also set the default value of the AdminClient.ENABLE_METRICS_PUSH_CONFIG to false.


Code Block
languagejava
firstline1
titleAdmin interface change
linenumberstrue
package org.apache.kafka.clients.admin;

public interface Admin extends AutoCloseable {  

/**
 *  ApplicationAn application metricsmetric provided for subscription.
 *  TheseThis metricsmetric will be added to this client's metrics
 *  that are available for subscription and sent as 
 *  telemetry data to the broker.
 *
 * @param metricsmetric, the application metricsmetric to register
 */ 
void registerMetricsForSubscription(Collection<? extends Metric> metrics)registerMetricForSubscription(KafkaMetric metric)

/**
 *  An application to be removed from subscription.
 *  This metric is removed from this client's metrics
 *  and will not be available for subscription.
 *
 * @param metric, the application metric to remove
 */ 
void unregisterMetricFromSubscription(KafkaMetric metric)


Code Block
languagejava
titleConsumer interface change
linenumberstrue
package org.apache.kafka.clients.consumer;

public interface Consumer<K, V> extends Closeable {
     

/**
 *  An Applicationapplication metricsmetric provided for subscription.
 *  TheseThis metricsmetric will be added to this client's metrics
 *  that are available for subscription and sent as 
 *  telemetry data to the broker.
 *
 * @param metricsmetric, the application metricsmetric to register
 */ 
void registerMetricForSubscription(KafkaMetric metric)

/**
 *  An application to be removed from 
void registerMetricsForSubscription(Collection<? extends Metric> metricssubscription.
 *  This metric is removed from this client's metrics
 *  and will not be available for subscription.
 *
 * @param metric, the application metric to remove
 */ 
void unregisterMetricFromSubscription(KafkaMetric metric)


Code Block
languagejava
titleProducer interface changes
linenumberstrue
package org.apache.kafka.clients.producer;

public interface Producer<K, V> extends Closeable {     

/**
 *  An Applicationapplication metricsmetric provided for subscription.
 *  TheseThis metricsmetric will be added to this client's metrics
 *  that are available for subscription and sent as 
 *  telemetry data to the broker.
 *
 * @param metricsmetric, the application metricsmetric to register
 */  
void registerMetricsForSubscription(Collection<? extends Metric> metricsregisterMetricForSubscription(KafkaMetric metric)

/**
 *  An application to be removed from subscription.
 *  This metric is removed from this client's metrics
 *  and will not be available for subscription.
 *
 * @param metric, the application metric to remove
 */ 
void unregisterMetricFromSubscription(KafkaMetric metric)

Metrics naming

...

Since this KIP uses the entire telemetry metrics pipeline of KIP-714, the metrics naming and formatting will leverage the same process and rules found in KIP-714. 

...