Interface EventBuilder

All Known Implementing Classes:
DefaultEventLogger.NoOpEventBuilder, SdkEventBuilder

public interface EventBuilder
The EventBuilder is used to emit() events.
  • Method Details

    • put

      default EventBuilder put(String key, String value)
      Put the given key and value in the payload.
    • put

      default EventBuilder put(String key, long value)
      Put the given key and value in the payload.
    • put

      default EventBuilder put(String key, double value)
      Put the given key and value in the payload.
    • put

      default EventBuilder put(String key, boolean value)
      Put the given key and value in the payload.
    • put

      default EventBuilder put(String key, String... value)
      Put the given key and value in the payload.
    • put

      default EventBuilder put(String key, long... value)
      Put the given key and value in the payload.
    • put

      default EventBuilder put(String key, double... value)
      Put the given key and value in the payload.
    • put

      default EventBuilder put(String key, boolean... value)
      Put the given key and value in the payload.
    • put

      default <T> EventBuilder put(AttributeKey<T> key, T value)
      Put the given key and value in the payload.

      NOTE: The key value pair is NOT added to the event attributes. Setting event attributes is less common than adding entries to the event payload. Use setAttributes(Attributes) if intending the data to be set in attributes instead of the payload.

    • put

      EventBuilder put(String key, Value<?> value)
      Put the given key and value in the payload.
    • setTimestamp

      EventBuilder setTimestamp(long timestamp, TimeUnit unit)
      Set the epoch timestamp, using the timestamp and unit.

      The timestamp is the time at which the event occurred. If unset, it will be set to the current time when emit() is called.

    • setTimestamp

      EventBuilder setTimestamp(Instant instant)
      Set the epoch timestamp, using the instant.

      The timestamp is the time at which the event occurred. If unset, it will be set to the current time when emit() is called.

    • setContext

      EventBuilder setContext(Context context)
      Set the context.
    • setSeverity

      EventBuilder setSeverity(Severity severity)
      Set the severity.
    • setAttributes

      EventBuilder setAttributes(Attributes attributes)
      Set the attributes.

      Event Attributes provide additional details about the Event which are not part of the well-defined Value payload. Setting event attributes is less common than adding entries to the event payload. Most users will want to call one of the #put(String, ?) methods instead.

    • emit

      void emit()
      Emit an event.