Table of Contents |
---|
Status
Current state: Under DiscusssionAdopted
Discussion thread: here
JIRA:
Jira | ||||||
---|---|---|---|---|---|---|
|
...
Code Block |
---|
public interface MetricsReporter extends Reconfigurable, AutoCloseable { [...] /** * Callback methodProvides providing context metadata for the * service or library exposing metrics * * @param metricsContext the metric context */ @InterfaceStability.Evolving default void contextChange(MetricsContext metricsContext) {} } |
...
Code Block |
---|
/** * MetricsContext encapsulates additional metadata about metrics exposed via a * {@link org.apache.kafka.common.metrics.MetricsReporter} * * The metadata map provides following information: * - a <code>_namespace</node> field indicating the component exposing metrics * e.g. kafka.server, kafka.consumer * {@link JmxReporter} uses this as prefix for mbean names * * - for clients and streams libraries: any freeform fields passed in via * client properties in the form of `metrics.context.<key>=<value> * * - for kafka brokers: kafka.broker.id, kafka.cluster.id * - for connect workers: connect.kafka.cluster.id, connect.group.id */ @InterfaceStability.Evolving public interface MetricsContext { /* predefined fields */ String NAMESPACE = "_namespace"; // metrics namespace, formerly jmx prefix /** * Returns metadata fields */ public Map<String, String> metadatacontextLabels(); } |
Connect, Streams and Client configuration changes
...
Kafka brokers will pass in fully resolved fields kafka.broker.id
and kafka.cluster.id
to the metric context.
In addition, similar to client, any metrics.context.<field>=<value>
entries passed in via broker configuration will also be added to the metrics context.
Connect Workers
Connect workers will pass the following fields to the metric context:
connect.kafka.cluster.id
to indicate the backing Kafka cluster used in distributed modeconnect.group.id
to indicate the group id used for worker coordination (only in distributed mode)
Connect will also propagate these fields to embedded clients via the metrics.context.
client properties.
...