Package io.micrometer.observation
Interface ObservationRegistry
public interface ObservationRegistry
Implementations of this interface are responsible for managing state of an
Observation.- Since:
- 1.10.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classAccess to configuration options for this registry. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ObservationRegistryNo-op implementation ofObservationRegistry. -
Method Summary
Modifier and TypeMethodDescriptionstatic ObservationRegistrycreate()Creates an instance ofObservationRegistry.@Nullable ObservationWhen previously set will allow to retrieve theObservationat any point in time.@Nullable Observation.ScopeWhen previously set will allow to retrieve theObservation.Scopeat any point in time.default booleanisNoop()Checks whether thisObservationRegistryis no-op.Configuration options for this registry.voidsetCurrentObservationScope(@Nullable Observation.Scope current) Sets the observation scope as current.
-
Field Details
-
NOOP
No-op implementation ofObservationRegistry.
-
-
Method Details
-
create
Creates an instance ofObservationRegistry.- Returns:
ObservationRegistryinstance
-
getCurrentObservation
@Nullable Observation getCurrentObservation()When previously set will allow to retrieve theObservationat any point in time. Example: if anObservationwas put inObservation.Scopethen this method will return the current presentObservationwithin the scope.- Returns:
- current observation or
nullif it's not present
-
getCurrentObservationScope
@Nullable Observation.Scope getCurrentObservationScope()When previously set will allow to retrieve theObservation.Scopeat any point in time. Example: if anObservationwas put inObservation.Scopethen this method will return the current presentObservation.Scope.- Returns:
- current observation scope or
nullif it's not present
-
setCurrentObservationScope
Sets the observation scope as current.- Parameters:
current- observation scope
-
observationConfig
ObservationRegistry.ObservationConfig observationConfig()Configuration options for this registry.- Returns:
- observation configuration
-
isNoop
default boolean isNoop()Checks whether thisObservationRegistryis no-op.- Returns:
truewhen this is a no-op observation registry
-