Top Description Fields Methods
io.micrometer.observation.docs

public Interface ObservationDocumentation

Known Direct Implementers
io.micrometer.observation.aop.ObservedAspectObservationDocumentation
Imports
io.micrometer.common.docs.KeyName, io.micrometer.common.lang.Nullable, io.micrometer.observation.*, java.util.Objects, java.util.function.Supplier

In order to describe your samples via e.g. enums instead of Strings you can use this interface that returns all the characteristics of a sample. We can analyze the sources and reuse this information to build a table of known metrics, their names and tags. We can generate documentation for all created samples but certain requirements need to be met.
Author
Marcin Grzejszczak
Since
1.10.0

Field Summary

Modifier and TypeField and Description
public static final KeyName[]
EMPTY

Empty key names.

public static final Observation.Event[]
EMPTY_EVENT_NAMES

Empty event names.

Method Summary

Modifier and TypeMethod and Description
public default String

Returns:

contextual name
getContextualName
()

More human-readable name available within the given context (e.g.: span name).

public default Class<? extends ObservationConvention<? extends Observation.Context>>

Returns:

default naming convention
getDefaultConvention
()

Default naming convention (sets technical and contextual names, and key values).

public default Observation.Event[]

Returns:

allowed event values
getEvents
()

Event values.

public default KeyName[]

Returns:

allowed tag keys for high cardinality key-values
getHighCardinalityKeyNames
()

High cardinality key names.

public default KeyName[]

Returns:

allowed tag keys for low cardinality key-values
getLowCardinalityKeyNames
()

Low cardinality key names.

public default String

Returns:

name
getName
()

Default technical name (e.g.: metric name).

public default String

Returns:

required prefix
getPrefix
()

Returns required prefix to be there for tags.

public default Observation

Returns:

observation
observation
(ObservationRegistry
observation registry
registry
)

Creates an Observation.

public default Observation

Returns:

observation
observation
(ObservationRegistry
observation registry
registry
,
Supplier<Observation.Context>
observation context supplier
contextSupplier
)

Creates an Observation.

public default <T extends Observation.Context> Observation

Returns:

observation
observation
(ObservationConvention<T>
convention that (if not null) will override any pre-configured conventions
customConvention
,
ObservationConvention<T>
default convention that will be picked if there was neither custom convention nor a pre-configured one via ObservationRegistry.ObservationConfig#observationConvention(GlobalObservationConvention)
defaultConvention
,
Supplier<T>
observation context supplier
contextSupplier
,
ObservationRegistry
observation registry
registry
)

Creates an Observation for the given ObservationConvention.

public default Observation

Returns:

observation
start
(ObservationRegistry
observation registry
registry
)

Creates and starts an Observation.

public default Observation

Returns:

observation
start
(ObservationRegistry
observation registry
registry
,
Supplier<Observation.Context>
observation context supplier
contextSupplier
)

Creates and starts an Observation.

public default <T extends Observation.Context> Observation

Returns:

observation
start
(ObservationConvention<T>
convention that (if not null) will override any pre-configured conventions
customConvention
,
ObservationConvention<T>
default convention that will be picked if there was neither custom convention nor a pre-configured one via ObservationRegistry.ObservationConfig#observationConvention(GlobalObservationConvention)
defaultConvention
,
Supplier<T>
observation context supplier
contextSupplier
,
ObservationRegistry
observation registry
registry
)

Creates and starts an Observation.

Field Detail

EMPTYback to summary
public static final KeyName[] EMPTY

Empty key names.

EMPTY_EVENT_NAMESback to summary
public static final Observation.Event[] EMPTY_EVENT_NAMES

Empty event names.

Method Detail

getContextualNameback to summary
public default String getContextualName()

More human-readable name available within the given context (e.g.: span name). You can set the name either by this method or getDefaultConvention(). This method will override what getDefaultConvention() has set.

Returns:String

contextual name

Annotations
@Nullable
getDefaultConventionback to summary
public default Class<? extends ObservationConvention<? extends Observation.Context>> getDefaultConvention()

Default naming convention (sets technical and contextual names, and key values). You can set the names either by this method or getName() and getContextualName().

Returns:Class<? extends ObservationConvention<? extends Observation.Context>>

default naming convention

Annotations
@Nullable
getEventsback to summary
public default Observation.Event[] getEvents()

Event values.

Returns:Observation.Event[]

allowed event values

getHighCardinalityKeyNamesback to summary
public default KeyName[] getHighCardinalityKeyNames()

High cardinality key names.

Returns:KeyName[]

allowed tag keys for high cardinality key-values

getLowCardinalityKeyNamesback to summary
public default KeyName[] getLowCardinalityKeyNames()

Low cardinality key names.

Returns:KeyName[]

allowed tag keys for low cardinality key-values

getNameback to summary
public default String getName()

Default technical name (e.g.: metric name). You can set the name either by this method or getDefaultConvention(). You can't use both.

Returns:String

name

Annotations
@Nullable
getPrefixback to summary
public 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:String

required prefix

observationback to summary
public default Observation observation(ObservationRegistry registry)

Creates an Observation. You need to manually start it.

Parameters
registry:ObservationRegistry

observation registry

Returns:Observation

observation

observationback to summary
public default Observation observation(ObservationRegistry registry, Supplier<Observation.Context> contextSupplier)

Creates an Observation. You need to manually start it. When the ObservationRegistry is null or the no-op registry, this fast returns a no-op Observation and skips the creation of the Observation.Context. This check avoids unnecessary Observation.Context creation, which is why it takes a Supplier for the context rather than the context directly. If the observation is not enabled by an ObservationPredicate, a no-op observation will also be returned.

Parameters
registry:ObservationRegistry

observation registry

contextSupplier:Supplier<Observation.Context>

observation context supplier

Returns:Observation

observation

observationback to summary
public default <T extends Observation.Context> Observation observation(ObservationConvention<T> customConvention, ObservationConvention<T> defaultConvention, Supplier<T> contextSupplier, ObservationRegistry registry)

Creates an Observation for the given ObservationConvention. You need to manually start it. When the ObservationRegistry is null or the no-op registry, this fast returns a no-op Observation and skips the creation of the Observation.Context. This check avoids unnecessary Observation.Context creation, which is why it takes a Supplier for the context rather than the context directly. If the observation is not enabled by an ObservationPredicate, a no-op observation will also be returned.

Parameters
customConvention:ObservationConvention<T>

convention that (if not null) will override any pre-configured conventions

defaultConvention:ObservationConvention<T>

default convention that will be picked if there was neither custom convention nor a pre-configured one via ObservationRegistry.ObservationConfig#observationConvention(GlobalObservationConvention)

contextSupplier:Supplier<T>

observation context supplier

registry:ObservationRegistry

observation registry

Returns:Observation

observation

startback to summary
public default Observation start(ObservationRegistry registry)

Creates and starts an Observation.

Parameters
registry:ObservationRegistry

observation registry

Returns:Observation

observation

startback to summary
public default Observation start(ObservationRegistry registry, Supplier<Observation.Context> contextSupplier)

Creates and starts an Observation. When the ObservationRegistry is null or the no-op registry, this fast returns a no-op Observation and skips the creation of the Observation.Context. This check avoids unnecessary Observation.Context creation, which is why it takes a Supplier for the context rather than the context directly. If the observation is not enabled by an ObservationPredicate, a no-op observation will also be returned.

Parameters
registry:ObservationRegistry

observation registry

contextSupplier:Supplier<Observation.Context>

observation context supplier

Returns:Observation

observation

startback to summary
public default <T extends Observation.Context> Observation start(ObservationConvention<T> customConvention, ObservationConvention<T> defaultConvention, Supplier<T> contextSupplier, ObservationRegistry registry)

Creates and starts an Observation. When the ObservationRegistry is null or the no-op registry, this fast returns a no-op Observation and skips the creation of the Observation.Context. This check avoids unnecessary Observation.Context creation, which is why it takes a Supplier for the context rather than the context directly. If the observation is not enabled by an ObservationPredicate, a no-op observation will also be returned.

Parameters
customConvention:ObservationConvention<T>

convention that (if not null) will override any pre-configured conventions

defaultConvention:ObservationConvention<T>

default convention that will be picked if there was neither custom convention nor a pre-configured one via ObservationRegistry.ObservationConfig#observationConvention(GlobalObservationConvention)

contextSupplier:Supplier<T>

observation context supplier

registry:ObservationRegistry

observation registry

Returns:Observation

observation