Package io.micrometer.observation
Class NullObservation
java.lang.Object
io.micrometer.observation.NullObservation
- All Implemented Interfaces:
Observation,ObservationView
A special
Observation that should be used only in special cases where clearing
of scopes is important. It will not call any handler methods except for scope related
ones.- Since:
- 1.10.8
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micrometer.observation.Observation
Observation.CheckedCallable<T,E extends Throwable>, Observation.CheckedRunnable<E extends Throwable>, Observation.Context, Observation.ContextView, Observation.Event, Observation.Scope -
Field Summary
Fields inherited from interface io.micrometer.observation.Observation
NOOP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncontextualName(String contextualName) Sets the name that can be defined from the contents of the context.Signals an error.event(Observation.Event event) Signals an arbitraryObservation.Event.Returns the context attached to this observation.Pops the last scope attached to thisObservationViewin this thread.highCardinalityKeyValue(io.micrometer.common.KeyValue keyValue) Adds a high cardinality key value.lowCardinalityKeyValue(io.micrometer.common.KeyValue keyValue) Adds a low cardinality key value.observationConvention(ObservationConvention<?> convention) Sets an observation convention that can be used to attach key values to the observation.When put in scope, additional operations can take place by theObservationHandlers such as putting entries in thread local.parentObservation(Observation parentObservation) If you have access to a previously createdObservationyou can manually set the parentObservationusing this method - that way you won't need to open scopes just to create a child observation.start()Starts the observation.voidstop()Stop the observation.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.micrometer.observation.Observation
getContextView, highCardinalityKeyValue, highCardinalityKeyValues, isNoop, lowCardinalityKeyValue, lowCardinalityKeyValues, observe, observe, observeChecked, observeChecked, scoped, scoped, scopedChecked, scopedChecked, wrap, wrap, wrapChecked, wrapChecked
-
Constructor Details
-
NullObservation
-
-
Method Details
-
start
Description copied from interface:ObservationStarts the observation. Remember to call this method, otherwise timing calculations will not take place.- Specified by:
startin interfaceObservation- Returns:
- this
-
contextualName
Description copied from interface:ObservationSets the name that can be defined from the contents of the context. E.g. a span name should not be the default observation name but one coming from an HTTP request.- Specified by:
contextualNamein interfaceObservation- Parameters:
contextualName- contextual name- Returns:
- this
-
parentObservation
Description copied from interface:ObservationIf you have access to a previously createdObservationyou can manually set the parentObservationusing this method - that way you won't need to open scopes just to create a child observation. If you're using theObservation.openScope()method then the parent observation will be automatically set, and you don't have to call this method.- Specified by:
parentObservationin interfaceObservation- Parameters:
parentObservation- parent observation to set- Returns:
- this
-
lowCardinalityKeyValue
Description copied from interface:ObservationAdds a low cardinality key value. Low cardinality means that this key value will have a bounded number of possible values. A templated HTTP URL is a good example of such a key value (e.g. /foo/{userId}).- Specified by:
lowCardinalityKeyValuein interfaceObservation- Parameters:
keyValue- key value- Returns:
- this
-
highCardinalityKeyValue
Description copied from interface:ObservationAdds a high cardinality key value. High cardinality means that this key value will have an unbounded number of possible values. An HTTP URL is a good example of such a key value (e.g. /foo/bar, /foo/baz etc.).- Specified by:
highCardinalityKeyValuein interfaceObservation- Parameters:
keyValue- key value- Returns:
- this
-
observationConvention
Description copied from interface:ObservationSets an observation convention that can be used to attach key values to the observation. Implementations should only set the convention when it supports (see:ObservationConvention.supportsContext(Context)) the currentObservation.Context. WARNING: You must set the ObservationConvention to the Observation before it is started.- Specified by:
observationConventionin interfaceObservation- Parameters:
convention- observation convention- Returns:
- this
-
error
Description copied from interface:ObservationSignals an error.- Specified by:
errorin interfaceObservation- Parameters:
error- error- Returns:
- this
-
event
Description copied from interface:ObservationSignals an arbitraryObservation.Event.- Specified by:
eventin interfaceObservation- Parameters:
event- event- Returns:
- this
-
getContext
Description copied from interface:ObservationReturns the context attached to this observation.- Specified by:
getContextin interfaceObservation- Returns:
- corresponding context
-
stop
public void stop()Description copied from interface:ObservationStop the observation. Remember to call this method, otherwise timing calculations won't be finished.- Specified by:
stopin interfaceObservation
-
openScope
Description copied from interface:ObservationWhen put in scope, additional operations can take place by theObservationHandlers such as putting entries in thread local.- Specified by:
openScopein interfaceObservation- Returns:
- new scope
-
getEnclosingScope
Description copied from interface:ObservationViewPops the last scope attached to thisObservationViewin this thread.- Specified by:
getEnclosingScopein interfaceObservationView- Returns:
- scope for this
ObservationView,nullif there was no scope
-
toString
-