Class ConfluentMetricNamingConvention

java.lang.Object
io.confluent.telemetry.collector.ConfluentMetricNamingConvention

public class ConfluentMetricNamingConvention extends Object
This class encapsulates Confluent naming and mapping conventions defined as part of https://confluentinc.atlassian.net/wiki/spaces/OBSERVE/pages/890537142/Metrics+Conventions
  • Field Details

  • 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

      public static MetricNamingStrategy<String> forAggregatedMetrics()
    • convertCase

      public static String convertCase(String raw)
      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

      public static String fullMetricName(String domain, String group, String name)
      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
    • cleanLabelNames

      public static Map<String,String> cleanLabelNames(Map<String,String> raw)
      Converts the label keys to snake_case.
      Parameters:
      raw - the input map
      Returns:
      the new map with keys replaced by snake_case representations.