Observation so that actions
can take place within the lifecycle of that observation via the
ObservationHandler.
According to what is configured the actions can be e.g. taking measurements via
Timer, creating spans for distributed tracing, correlating logs or just logging
out additional information. You instrument your code once with an Observation
but you can get as many benefits out of it as many ObservationHandler you have.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Observation.CheckedCallable<T, E extends Throwable>
A functional interface like |
| public static interface | Observation.CheckedFunction<T, R, E extends Throwable>
A functional interface like |
| public static interface | Observation.CheckedRunnable<E extends Throwable>
A functional interface like |
| public static class | Observation.Context
A mutable holder of data required by an |
| public static interface | Observation.ContextView
Read only view on the |
| public static interface | Observation.Event
An arbitrary event that you can extend and signal during an |
| public static interface | Observation.Scope
Scope represent an action within which certain resources (e.g. tracing context) are put in scope (e.g. in a ThreadLocal). |
| Modifier and Type | Field and Description |
|---|---|
| public static final Observation | NOOP
No-op observation. |
| Modifier and Type | Method and Description |
|---|---|
| public Observation | Returns: thiscontextual name contextualName)Sets the name that can be defined from the contents of the context. |
| public static Observation | Returns: created but not started observationname of the observation name, ObservationRegistry observation registry registry)Creates but does not start an |
| public static <T extends Observation. | Returns: created but not started observationname of the observation name, Supplier<T> supplier for mutable context contextSupplier, ObservationRegistry observation registry registry)Creates but does not start an |
| public static < type of context T extends Observation. | Returns: created but not started observationcustom convention. If customConvention, ObservationConvention<T> null, the default one will be
picked.default convention when no custom convention was passed,
nor a pre-configured one was found defaultConvention, Supplier<T> supplier for the observation context contextSupplier, ObservationRegistry observation registry registry)Creates but does not start an |
| public static Observation | Returns: created but not started observationobservation convention observationConvention,observation registry registry)Creates but does not start an |
| public static < type of context T extends Observation. | Returns: created but not started observationobservation convention observationConvention, Supplier<T> mutable context supplier contextSupplier, ObservationRegistry observation registry registry)Creates but does not start an |
| public Observation | |
| public Observation | |
| public Observation. | |
| public default Observation. | Returns: corresponding contextImplements io. |
| public Observation | |
| public default Observation | Returns: thiskey key, String value value)Adds a high cardinality key value. |
| public default Observation | Returns: thiskey value instances keyValues)Adds multiple high cardinality key value instances. |
| public default boolean | |
| public Observation | |
| public default Observation | Returns: thiskey key, String value value)Adds a low cardinality key value. |
| public default Observation | Returns: thiskey value instances keyValues)Adds multiple low cardinality key value instances. |
| public Observation | Returns: thisobservation convention observationConvention)Sets an observation convention that can be used to attach key values to the observation. |
| public default void | observe(Runnable
the runnable)Runnable to runObserves the passed
|
| public default < the type parameter of the T> TSupplier | Returns: the result fromSupplier#get()the supplier)Supplier to callObserves the passed
|
| public default < type of exception thrown E extends Throwable> void | observeChecked(Observation.
the checkedRunnableCheckedRunnable to runObserves the passed
|
| public default < the return type of the T, CheckedCallabletype of exception checkedCallable throws E extends Throwable> T | Returns: the result fromCheckedCallable#call()the checkedCallableCheckedCallable to callObserves the passed
|
| public default < the type of input C extends Observation.Context to the functionthe type of return to the function T, type of exception E extends Throwable> TCheckedFunction throws | Returns: the result fromFunction#apply(Object)the functionCheckedFunction to call
Deprecated
scheduled for removal in 1.15.0, use
Observes the passed observeChecked(...)
directly
Function which provides access to the Context.
|
| public default < the type of input C extends Observation.Context to the functionthe type parameter of the T> TFunction return | Returns: the result fromFunction#apply(Object)the function)Function to call
Deprecated
scheduled for removal in 1.15.0, use
Observes the passed observe(...) directly
Function which provides access to the Context.
|
| public Observation. | Returns: new scopeWhen put in scope, additional operations can take place by the
|
| public Observation | Returns: thisparent observation to set parentObservation)If you have access to a previously created |
| public default void | |
| public default < the return type of the T> TSupplier | Returns: the result fromSupplier#get()the supplier)Supplier to callWraps the given action in a scope and signals an error. |
| public default < type of exception thrown E extends Throwable> void | scopedChecked(Observation.
the checkedRunnableCheckedRunnable to runWraps the given action in a scope and signals an error. |
| public default < the return type of the T, CheckedCallabletype of exception checkedCallable throws E extends Throwable> T | Returns: the result fromCheckedCallable#call()the checkedCallableCheckedCallable to callWraps the given action in a scope and signals an error. |
| public static Observation | Returns: a started observationname of the observation name, ObservationRegistry observation registry registry)Create and start an |
| public static <T extends Observation. | Returns: started observationname of the observation name, Supplier<T> mutable context supplier contextSupplier, ObservationRegistry observation registry registry)Creates and starts an |
| public static Observation | Returns: started observationobservation convention observationConvention,observation registry registry)Creates and starts an |
| public static < type of context T extends Observation. | Returns: started observationobservation convention observationConvention, Supplier<T> mutable context supplier contextSupplier, ObservationRegistry observation registry registry)Creates and starts an |
| public static < type of context T extends Observation. | Returns: started observationcustom convention. If customConvention, ObservationConvention<T> null, the default one will be
picked.default convention when no custom convention was passed,
nor a configured one was found defaultConvention, Supplier<T> the observation context supplier contextSupplier, ObservationRegistry observation registry registry)Creates and starts an |
| public Observation | |
| public void | |
| public static void | tryScoped(Observation
observation, potentially parent, Runnable nullaction to run action)Tries to run the action against an Observation. |
| public static <T> T | Returns: result of the actionobservation, potentially parent, Supplier<T> nullaction to run action)Tries to run the action against an Observation. |
| public static < type of exception checkedRunnable throws E extends Throwable> void | tryScopedChecked(Observation
observation, potentially parent, Observation.nullthe checkedRunnableCheckedRunnable to runTries to run the action against an Observation. |
| public static < the return type of the T, CheckedCallabletype of exception checkedCallable throws E extends Throwable> T | Returns: the result fromCheckedCallable#call()observation, potentially parent, Observation.nullthe checkedCallableCheckedCallable to callTries to run the action against an Observation. |
| public default Runnable | |
| public default <T> Supplier | |
| public default <E extends Throwable> Observation. | |
| public default <T, E extends Throwable> Observation. |