Annotation Interface ObservationKeyValue
@Retention(RUNTIME)
@Inherited
@Target({PARAMETER,METHOD})
@Repeatable(ObservationKeyValues.class)
public @interface ObservationKeyValue
There are 3 different ways to add key-values to an observation. 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. Cardinality also can be set by cardinality(). default value
is Cardinality.HIGH.-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionCardinality of the key-value.Execute this expression to calculate the key-value value.The name of the key of the key-value which should be created.Class<? extends io.micrometer.common.annotation.ValueResolver> Use this object to resolve the key-value value.The name of the key of the key-value which should be created.
-
Element Details
-
value
String valueThe name of the key of the key-value which should be created. This is an alias forkey().- Returns:
- the key-value key name
- Default:
""
-
key
String keyThe name of the key of the key-value which should be created.- Returns:
- the key-value key name
- Default:
""
-
expression
String expressionExecute this expression to calculate the key-value value. Will be evaluated if no value of theresolver()was set. You need to have aValueExpressionResolverregistered on theObservationKeyValueAnnotationHandlerto provide the expression resolution engine.- Returns:
- an expression
- Default:
""
-
resolver
Class<? extends io.micrometer.common.annotation.ValueResolver> resolverUse this object to resolve the key-value value. Has the highest precedence.- Returns:
ValueResolverclass
- Default:
io.micrometer.common.annotation.NoOpValueResolver.class
-
cardinality
Cardinality cardinalityCardinality of the key-value.- Returns:
Cardinalityclass
- Default:
HIGH
-