Annotation Interface MeterTag


@Retention(RUNTIME) @Inherited @Target(PARAMETER) public @interface MeterTag
There are 3 different ways to add tags to a meter. All of them are controlled by the annotation values. Precedence is to first try with the ValueResolver. If the value of the resolver wasn't set, try to evaluate an expression. If there’s no expression just return a toString() value of the parameter. IMPORTANT: Provided tag values MUST BE of LOW-CARDINALITY. If you fail to provide low-cardinality values, that can lead to performance issues of your metrics backend. Values should not come from the end-user since those could be high-cardinality.
Since:
1.11.0
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Execute this expression to calculate the tag value.
    The name of the key of the tag which should be created.
    Class<? extends io.micrometer.common.annotation.ValueResolver>
    Use this object to resolve the tag value.
    The name of the key of the tag which should be created.
  • Element Details

    • value

      String value
      The name of the key of the tag which should be created. This is an alias for key().
      Returns:
      the tag key name
      Default:
      ""
    • key

      String key
      The name of the key of the tag which should be created.
      Returns:
      the tag key name
      Default:
      ""
    • expression

      String expression
      Execute this expression to calculate the tag value. Will be evaluated if no value of the resolver() was set. You need to have a ValueExpressionResolver registered on the MeterTagAnnotationHandler to provide the expression resolution engine.
      Returns:
      an expression
      Default:
      ""
    • resolver

      Class<? extends io.micrometer.common.annotation.ValueResolver> resolver
      Use this object to resolve the tag value. Has the highest precedence.
      Returns:
      ValueResolver class
      Default:
      io.micrometer.common.annotation.NoOpValueResolver.class