Interface EventEmitter


@ThreadSafe public interface EventEmitter
A EventEmitter is the entry point into an event pipeline.

Example usage emitting events:


 class MyClass {
   private final EventEmitter eventEmitter = openTelemetryEventEmitterProvider.eventEmitterBuilder("scope-name")
         .setEventDomain("acme.observability")
         .build();

   void doWork() {
     eventEmitter.emit("my-event", Attributes.builder()
         .put("key1", "value1")
         .put("key2", "value2")
         .build())
     // do work
   }
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    builder(String eventName, io.opentelemetry.api.common.Attributes attributes)
    Return a EventBuilder to emit an event.
    void
    emit(String eventName, io.opentelemetry.api.common.Attributes attributes)
    Emit an event.
  • Method Details

    • emit

      void emit(String eventName, io.opentelemetry.api.common.Attributes attributes)
      Emit an event.
      Parameters:
      eventName - the event name, which acts as a classifier for events. Within a particular event domain, event name defines a particular class or type of event.
      attributes - attributes associated with the event
    • builder

      EventBuilder builder(String eventName, io.opentelemetry.api.common.Attributes attributes)
      Return a EventBuilder to emit an event.
      Parameters:
      eventName - the event name, which acts as a classifier for events. Within a particular event domain, event name defines a particular class or type of event.
      attributes - attributes associated with the event