Package io.confluent.telemetry.collector
Class ConfluentMetricNamingConvention
java.lang.Object
io.confluent.telemetry.collector.ConfluentMetricNamingConvention
This class encapsulates Confluent naming and mapping conventions defined as part of
https://confluentinc.atlassian.net/wiki/spaces/OBSERVE/pages/890537142/Metrics+Conventions
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncleanLabelNames(Map<String, String> raw) Converts the label keys to snake_case.static StringconvertCase(String raw) Converts a tag/name to match the telemetry naming conventions by converting snake_case.static MetricNamingStrategy<String> static MetricNamingStrategy<org.apache.kafka.common.MetricName> forKafkaMetrics(String domain, boolean addOriginalName, boolean addLibraryName) static MetricNamingStrategy<com.yammer.metrics.core.MetricName> forYammerMetrics(String domain, boolean addOriginalName, boolean addLibraryName) static StringfullMetricName(String domain, String group, String name) Creates a metric name given the domain, group, and name.
-
Field Details
-
KAFKA_METRICS_LIB
- See Also:
-
YAMMER_METRICS_LIB
- See Also:
-
-
Constructor Details
-
ConfluentMetricNamingConvention
public ConfluentMetricNamingConvention()
-
-
Method Details
-
forKafkaMetrics
public static MetricNamingStrategy<org.apache.kafka.common.MetricName> forKafkaMetrics(String domain, boolean addOriginalName, boolean addLibraryName) -
forYammerMetrics
public static MetricNamingStrategy<com.yammer.metrics.core.MetricName> forYammerMetrics(String domain, boolean addOriginalName, boolean addLibraryName) -
forAggregatedMetrics
-
convertCase
Converts a tag/name to match the telemetry naming conventions by converting snake_case.Kafka metrics have tags/name in lower case separated by hyphens. Eg: total-errors Yammer metrics have tags/name in upper camelcase. Eg: TotalErrors Some KSQL metrics have weird casing where the metric name is a mix of upper case words separated by underscore along with lower case words separated by hyphen. Eg: PENDING_SHUTDOWN-queries
- Parameters:
raw-- Returns:
-
fullMetricName
Creates a metric name given the domain, group, and name. The new String follows the following conventions and rules:- domain is expected to be a host-name like value, e.g.
io.confluent.kafka.server - group is cleaned of redundant words: "kafka," "metrics," and "stats"
- the group and name are converted to snake_case
- The name is created by joining the three components, e.g.:
io.confluent.kafka.producer/request_metrics/produce_request_time_ms
- domain is expected to be a host-name like value, e.g.
-
cleanLabelNames
Converts the label keys to snake_case.- Parameters:
raw- the input map- Returns:
- the new map with keys replaced by snake_case representations.
-