Package io.micrometer.observation
Interface Observation.Event
- Enclosing interface:
Observation
public static interface Observation.Event
An arbitrary event that you can extend and signal during an
Observation
.
This helps you to tell to the ObservationHandler
that something happened.
If you want to signal an exception/error, please use
Observation.error(Throwable)
instead.-
Method Summary
Modifier and TypeMethodDescriptiondefault Observation.Event
Creates a new event with the given dynamic entries for the contextual name.default String
Returns the contextual name of the event.getName()
Returns the name of the event.default long
Wall time in milliseconds since the epoch.static Observation.Event
Creates anObservation.Event
for the given name.static Observation.Event
Creates anObservation.Event
for the given names.static Observation.Event
Creates anObservation.Event
for the given names and timestamp (wall time).
-
Method Details
-
of
Creates anObservation.Event
for the given names.- Parameters:
name
- The name of the event (should have low cardinality).contextualName
- The contextual name of the event (can have high cardinality).- Returns:
- event
-
of
Creates anObservation.Event
for the given names and timestamp (wall time).- Parameters:
name
- The name of the event (should have low cardinality).contextualName
- The contextual name of the event (can have high cardinality).wallTime
- Wall time in milliseconds since the epoch- Returns:
- event
- Since:
- 1.12.0
-
of
Creates anObservation.Event
for the given name.- Parameters:
name
- The name of the event (should have low cardinality).- Returns:
- event
-
getName
String getName()Returns the name of the event.- Returns:
- the name of the event.
-
getWallTime
default long getWallTime()Wall time in milliseconds since the epoch. Typically equivalent toSystem.currentTimeMillis()
. Should not be used to determine durations. Used for timestamping events that happened during Observations.- Returns:
- Wall time in milliseconds since the epoch
- Since:
- 1.12.0
-
getContextualName
Returns the contextual name of the event. You can use%s
to represent dynamic entries that should be resolved at runtime viaString.format(String, Object...)
.- Returns:
- the contextual name of the event.
-
format
Creates a new event with the given dynamic entries for the contextual name.- Parameters:
dynamicEntriesForContextualName
- variables to be resolved ingetContextualName()
viaString.format(String, Object...)
.- Returns:
- event
-