Package io.micrometer.observation
Interface Observation.Scope
- All Superinterfaces:
AutoCloseable
- Enclosing interface:
Observation
Scope represent an action within which certain resources (e.g. tracing context) are
put in scope (e.g. in a ThreadLocal). When the scope is closed the resources will
be removed from the scope.
- Since:
- 1.10.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Clears the current scope and notifies the handlers that the scope was closed.Current observation available within this scope.default booleanisNoop()Checks whether thisObservation.Scopeis no-op.voidreset()Clears the current scope and notifies the handlers that the scope was reset.
-
Field Details
-
NOOP
No-op scope.
-
-
Method Details
-
getCurrentObservation
Observation getCurrentObservation()Current observation available within this scope.- Returns:
- current observation that this scope was created by
-
close
void close()Clears the current scope and notifies the handlers that the scope was closed. You don't need to call this method manually. If you use try-with-resource, it will call this for you. Please only call this method if you know what you are doing and your use-case demands the usage of it.- Specified by:
closein interfaceAutoCloseable
-
reset
void reset()Clears the current scope and notifies the handlers that the scope was reset. You don't need to call this method in most of the cases. Please only call this method if you know what you are doing and your use-case demands the usage of it.- Since:
- 1.10.4
-
isNoop
default boolean isNoop()Checks whether thisObservation.Scopeis no-op.- Returns:
truewhen this is a no-op scope
-