Interface MetricNamingStrategy<T>


public interface MetricNamingStrategy<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    derivedMetricKey(MetricKey key, String derivedComponent)
    Creates a derived metric key from an existing metric key.
    metricKey(T metricName)
    Converts an implementation-specific metric name (e.g.
  • Method Details

    • metricKey

      MetricKey metricKey(T metricName)
      Converts an implementation-specific metric name (e.g. Kafka MetricName or Yammer MetricName) representing a particular metric name and associated label into a canonical MetricKey (name + labels) representation Each strategy may define its own conventions for how the resulting metric should be named, including things such conforming name and labels to use specific casing and separators for different parts of the metric name.
      Parameters:
      metricName - the implementation-specific metric
      Returns:
      the resulting metric key
    • derivedMetricKey

      MetricKey derivedMetricKey(MetricKey key, String derivedComponent)
      Creates a derived metric key from an existing metric key.

      Some metrics may include multiple components derived from the same underlying source of data – e.g. a Meter may expose multiple rates and a counter – in which case it may be desirable to create a new metric key derived from the primary one, with a different name for each component of the metric.

      Some metrics may be derived from others by the collector itself, e.g. a delta metric might be created from a cumulative counter, or a cumulative metric might be created from a histogram.

      This method exists so each strategy can define its own convention for how to name derived metrics keys.

      The resulting key should have the same labels as the input key, and its name new name will typically be composed of the input key name and the component name.

      Parameters:
      key - the input metric key used to construct the derived key
      derivedComponent - the name to use for the derived component of the input metric
      Returns:
      a key with a new metric name composed of the input key name and the additional name