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.CheckedFunction<T, R, 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 thisObservationView
in this thread.Returns theObservationRegistry
attached to this observation.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 theObservationHandler
s such as putting entries in thread local.parentObservation
(Observation parentObservation) If you have access to a previously createdObservation
you can manually set the parentObservation
using this method - that way you won't need to open scopes just to create a child observation.start()
Starts the observation.void
stop()
Stop the observation.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.micrometer.observation.Observation
getContextView, highCardinalityKeyValue, highCardinalityKeyValues, isNoop, lowCardinalityKeyValue, lowCardinalityKeyValues, observe, observe, observeChecked, observeChecked, observeCheckedWithContext, observeWithContext, scoped, scoped, scopedChecked, scopedChecked, wrap, wrap, wrapChecked, wrapChecked
-
Constructor Details
-
NullObservation
-
-
Method Details
-
start
Description copied from interface:Observation
Starts the observation. Remember to call this method, otherwise timing calculations will not take place.- Specified by:
start
in interfaceObservation
- Returns:
- this
-
contextualName
Description copied from interface:Observation
Sets 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:
contextualName
in interfaceObservation
- Parameters:
contextualName
- contextual name- Returns:
- this
-
parentObservation
Description copied from interface:Observation
If you have access to a previously createdObservation
you can manually set the parentObservation
using 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:
parentObservation
in interfaceObservation
- Parameters:
parentObservation
- parent observation to set- Returns:
- this
-
lowCardinalityKeyValue
Description copied from interface:Observation
Adds 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:
lowCardinalityKeyValue
in interfaceObservation
- Parameters:
keyValue
- key value- Returns:
- this
-
highCardinalityKeyValue
Description copied from interface:Observation
Adds 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:
highCardinalityKeyValue
in interfaceObservation
- Parameters:
keyValue
- key value- Returns:
- this
-
observationConvention
Description copied from interface:Observation
Sets 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:
observationConvention
in interfaceObservation
- Parameters:
convention
- observation convention- Returns:
- this
-
error
Description copied from interface:Observation
Signals an error.- Specified by:
error
in interfaceObservation
- Parameters:
error
- error- Returns:
- this
-
event
Description copied from interface:Observation
Signals an arbitraryObservation.Event
.- Specified by:
event
in interfaceObservation
- Parameters:
event
- event- Returns:
- this
-
getContext
Description copied from interface:Observation
Returns the context attached to this observation.- Specified by:
getContext
in interfaceObservation
- Returns:
- corresponding context
-
stop
public void stop()Description copied from interface:Observation
Stop the observation. Remember to call this method, otherwise timing calculations won't be finished.- Specified by:
stop
in interfaceObservation
-
openScope
Description copied from interface:Observation
When put in scope, additional operations can take place by theObservationHandler
s such as putting entries in thread local.- Specified by:
openScope
in interfaceObservation
- Returns:
- new scope
-
getEnclosingScope
Description copied from interface:ObservationView
Pops the last scope attached to thisObservationView
in this thread.- Specified by:
getEnclosingScope
in interfaceObservationView
- Returns:
- scope for this
ObservationView
,null
if there was no scope
-
toString
-
getObservationRegistry
Description copied from interface:ObservationView
Returns theObservationRegistry
attached to this observation.- Specified by:
getObservationRegistry
in interfaceObservationView
- Returns:
- corresponding observation registry
-