Events SDK

Status: Experimental

Users of OpenTelemetry need a way for instrumentation interactions with the OpenTelemetry API to actually produce telemetry. The OpenTelemetry SDK (henceforth referred to as the SDK) is an implementation of the OpenTelemetry API that provides users with this functionally.

All implementations of the OpenTelemetry API MUST provide an SDK.

Overview

From OpenTelemetry’s perspective LogRecords and Events are both represented using the same data model. Therefore, the default implementation of an Event SDK MUST generate events using the Logs Data Model.

The SDK MAY be implemented on top of the Logs Bridge API.

EventLoggerProvider

TODO

EventLogger

TODO

Emit Event

Emit a LogRecord representing an Event.

Implementation Requirements:

The implementation MUST use the parameters to emit a logRecord as follows:

  • The Name MUST be used to set the event.name Attribute. If the Attributes provided by the user contain an event.name attribute the value provided in the Name takes precedence.
  • If provided by the user, the Payload MUST be used to set the Body. If not provided, Body MUST not be set.
  • If provided by the user, the Timestamp MUST be used to set the Timestamp. If not provided, Timestamp MUST be set to the current time when emit was called.
  • The Observed Timestamp MUST not be set. (NOTE: emit a logRecord will set ObservedTimestamp to the current time when unset.)
  • If provided by the user, the Context MUST be used to set the Context. If not provided, Context MUST be set to the current Context.
  • If provided by the user, the SeverityNumber MUST be used to set the Severity Number when emitting the logRecord. If not provided, SeverityNumber MUST be set to SEVERITY_NUMBER_INFO=9.
  • The Severity Text MUST not be set.
  • If provided by the user, the Attributes MUST be used to set the Attributes. The user provided Attributes MUST not take over the event.name attribute previously discussed.

Additional Interfaces

TODO