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 Details

    • of

      static Observation.Event of(String name, String contextualName)
      Creates an Observation.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

      static Observation.Event of(String name, String contextualName, long wallTime)
      Creates an Observation.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

      static Observation.Event of(String name, String contextualName, long wallTime, Iterable<io.micrometer.common.KeyValue> highCardinalityKeyValues)
      Creates an Observation.Event with 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 epoch
      highCardinalityKeyValues - 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 an Observation.Event with 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 epoch
      highCardinalityKeyValues - high-cardinality metadata specific to the event
      lowCardinalityKeyValues - low-cardinality metadata specific to the event
      Returns:
      event
      Since:
      1.18.0
    • of

      static Observation.Event of(String name)
      Creates an Observation.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 to System.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

      default String getContextualName()
      Returns the contextual name of the event. You can use %s to represent dynamic entries that should be resolved at runtime via String.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 of KeyValues. 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 of KeyValues. 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 of KeyValues. 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

      default Observation.Event format(Object... dynamicEntriesForContextualName)
      Creates a new event with the given dynamic entries for the contextual name.
      Parameters:
      dynamicEntriesForContextualName - variables to be resolved in getContextualName() via String.format(String, Object...).
      Returns:
      event