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.- Since:
- 1.10.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault Observation.EventCreates a new event with the given dynamic entries for the contextual name.default StringReturns the contextual name of the event.default io.micrometer.common.KeyValuesHigh-cardinality metadata about the event in the form ofKeyValues.default io.micrometer.common.KeyValuesAll metadata about the event in the form ofKeyValues.default io.micrometer.common.KeyValuesLow-cardinality metadata about the event in the form ofKeyValues.getName()Returns the name of the event.default longWall time in milliseconds since the epoch.static Observation.EventCreates anObservation.Eventfor the given name.static Observation.EventCreates anObservation.Eventfor the given names.static Observation.EventCreates anObservation.Eventfor the given names and timestamp (wall time).static Observation.Eventof(String name, String contextualName, long wallTime, Iterable<io.micrometer.common.KeyValue> highCardinalityKeyValues) Creates anObservation.Eventwith high-cardinality key-values.static Observation.Eventof(String name, String contextualName, long wallTime, Iterable<io.micrometer.common.KeyValue> highCardinalityKeyValues, Iterable<io.micrometer.common.KeyValue> lowCardinalityKeyValues) Creates anObservation.Eventwith high- and low-cardinality key-values.
-
Method Details
-
of
Creates anObservation.Eventfor 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.Eventfor 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
static Observation.Event of(String name, String contextualName, long wallTime, Iterable<io.micrometer.common.KeyValue> highCardinalityKeyValues) Creates anObservation.Eventwith high-cardinality key-values.- 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 when the event happened in milliseconds since the epochhighCardinalityKeyValues- high-cardinality metadata specific to the event- Returns:
- event
- Since:
- 1.18.0
-
of
static Observation.Event of(String name, String contextualName, long wallTime, Iterable<io.micrometer.common.KeyValue> highCardinalityKeyValues, Iterable<io.micrometer.common.KeyValue> lowCardinalityKeyValues) Creates anObservation.Eventwith high- and low-cardinality key-values.- 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 when the event happened in milliseconds since the epochhighCardinalityKeyValues- high-cardinality metadata specific to the eventlowCardinalityKeyValues- low-cardinality metadata specific to the event- Returns:
- event
- Since:
- 1.18.0
-
of
Creates anObservation.Eventfor the given name.- Parameters:
name- The name of the event (should have low cardinality).- Returns:
- event
-
getName
-
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%sto represent dynamic entries that should be resolved at runtime viaString.format(String, Object...).- Returns:
- the contextual name of the event.
-
getLowCardinalityKeyValues
default io.micrometer.common.KeyValues getLowCardinalityKeyValues()Low-cardinality metadata about the event in the form ofKeyValues. It may be empty if there is no low-cardinality metadata specific to the event.- Returns:
- low-cardinality key values associated with this event
- Since:
- 1.18.0
-
getHighCardinalityKeyValues
default io.micrometer.common.KeyValues getHighCardinalityKeyValues()High-cardinality metadata about the event in the form ofKeyValues. It may be empty if there is no high-cardinality metadata specific to the event.- Returns:
- high-cardinality key values associated with this event
- Since:
- 1.18.0
-
getKeyValues
default io.micrometer.common.KeyValues getKeyValues()All metadata about the event in the form ofKeyValues. It may be empty if there is no metadata specific to the event.- Returns:
- key values associated with this event
- Since:
- 1.18.0
-
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
-