Interface MeterDocumentation

All Known Implementing Classes:
NettyMeters

public interface MeterDocumentation
In order to describe your metrics via e.g. enums instead of Strings you can use this interface that returns all the characteristics of a metric. We can generate documentation for all created metrics but certain requirements need to be met
  • Metrics are grouped within an enum - the enum implements the MeterDocumentation interface
  • If the span contains KeyName then those need to be declared as nested enums
  • The getKeyNames() need to call the nested enum's values() method to retrieve the array of allowed keys / events
  • Javadocs around enums will be used as description
Since:
1.10.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final io.micrometer.common.docs.KeyName[]
    Empty key names.
  • Method Summary

    Modifier and Type
    Method
    Description
    default io.micrometer.common.docs.KeyName[]
    Additional key names.
    default String
    Base unit.
    default io.micrometer.common.docs.KeyName[]
    Allowed key names.
    Metric name.
    default String
    getName(String... vars)
    Builds a name from provided vars.
    default String
    Returns required prefix to be there for tags.
    Type of this metric.
    default Enum<?>
    Override this when custom metric should be documented instead of the default one.
  • Field Details

    • EMPTY

      static final io.micrometer.common.docs.KeyName[] EMPTY
      Empty key names.
  • Method Details

    • getName

      String getName()
      Metric name.
      Returns:
      metric name
    • getBaseUnit

      @Nullable default String getBaseUnit()
      Base unit.
      Returns:
      base unit
    • getType

      Meter.Type getType()
      Type of this metric.
      Returns:
      meter type
    • getName

      default String getName(String... vars)
      Builds a name from provided vars. Follows the String.format(String, Object...) patterns.
      Parameters:
      vars - variables to pass to String.format(String, Object...)
      Returns:
      constructed name
    • getKeyNames

      default io.micrometer.common.docs.KeyName[] getKeyNames()
      Allowed key names.
      Returns:
      allowed key names - if set will override any key names coming from overridesDefaultMetricFrom()
    • getAdditionalKeyNames

      default io.micrometer.common.docs.KeyName[] getAdditionalKeyNames()
      Additional key names.
      Returns:
      additional key names - if set will append any key names coming from overridesDefaultMetricFrom()
    • overridesDefaultMetricFrom

      default Enum<?> overridesDefaultMetricFrom()
      Override this when custom metric should be documented instead of the default one. Requires the Observation module on the classpath.
      Returns:
      MeterDocumentation for which you don't want to create a default metric documentation
    • getPrefix

      default String getPrefix()
      Returns required prefix to be there for tags. For example, foo. would require the tags to have a foo. prefix like this: foo.bar=true.
      Returns:
      required prefix