Package org.apache.kafka.common.metrics
Class KafkaMetricsContext
java.lang.Object
org.apache.kafka.common.metrics.KafkaMetricsContext
- All Implemented Interfaces:
MetricsContext
public class KafkaMetricsContext extends Object implements MetricsContext
A implementation of MetricsContext, it encapsulates required metrics context properties for Kafka services and clients
-
Field Summary
Fields inherited from interface org.apache.kafka.common.metrics.MetricsContext
NAMESPACE -
Constructor Summary
Constructors Constructor Description KafkaMetricsContext(String namespace)Create a MetricsContext with namespace, no service or client propertiesKafkaMetricsContext(String namespace, Map<String,?> contextLabels)Create a MetricsContext with namespace, service or client properties -
Method Summary
Modifier and Type Method Description Map<String,String>contextLabels()Returns the labels for this metrics context.
-
Constructor Details
-
KafkaMetricsContext
Create a MetricsContext with namespace, no service or client properties- Parameters:
namespace- value for _namespace key
-
KafkaMetricsContext
Create a MetricsContext with namespace, service or client properties- Parameters:
namespace- value for _namespace keycontextLabels- contextLabels additional entries to add to the context. values will be converted to string using Object.toString()
-
-
Method Details
-
contextLabels
Description copied from interface:MetricsContextReturns the labels for this metrics context.- Specified by:
contextLabelsin interfaceMetricsContext- Returns:
- the map of label keys and values; never null but possibly empty
-