Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event basics #265

Merged
merged 27 commits into from
Sep 19, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions text/0265-event-vision.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Event basics

## Motivation

The introduction of Events has been contentious, so we want to write down and agree on a few basics.
trask marked this conversation as resolved.
Show resolved Hide resolved
trask marked this conversation as resolved.
Show resolved Hide resolved

### What are events?

Events are a type of log which has a required event name and a specific structure which is implied by that event name.
MrAlias marked this conversation as resolved.
Show resolved Hide resolved

The event name and its implied structure make events much more suitable for observability compared to traditional logs.
trask marked this conversation as resolved.
Show resolved Hide resolved

Because of this, the OpenTelemetry project wants to encourage the transition from traditional logs to events.
trask marked this conversation as resolved.
Show resolved Hide resolved

### OTLP

Since events are a type of log, they share the same OTLP data structure and OTLP pipeline.

### API

OpenTelemetry should have an Event API. This will help to promote the distinction between events and traditional logs,
trask marked this conversation as resolved.
Show resolved Hide resolved
and encourage the use of events over traditional logs.

### Interoperability with traditional logs

It should be possible to send events from the Event API to a traditional logging library (e.g. Log4j).
trask marked this conversation as resolved.
Show resolved Hide resolved
This allows users to integrate events from the Event API into an existing (non-OpenTelemetry) log stream.

Note: If a user chooses to send events from the Event API to a traditional logging library, and they have
trask marked this conversation as resolved.
Show resolved Hide resolved
also chosen to send the logs from their traditional logging library to the OpenTelemetry Logging SDK, then they should
avoid sending events from the Event API directly to the OpenTelemetry Logging SDK since that would lead to duplicate
trask marked this conversation as resolved.
Show resolved Hide resolved
capture of events that were sent from the Event API.

It should be possible to bypass the Event API entirely and emit Events directly via an existing language-specific logging libraries.
trask marked this conversation as resolved.
Show resolved Hide resolved
trask marked this conversation as resolved.
Show resolved Hide resolved
This helps reinforce the idea that events are just a specific type of log.

Note: Because of this, generic event processors should be implemented as Log SDK processors.

OpenTelemetry will recommend that
[instrumentation libraries](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/glossary.md#instrumentation-library)
use the Event API over emitting events via a traditional logging library in order to give users a simple and consistent
onboarding story that doesn't involve mixing the two approaches.

OpenTelemetry will recommend that application developers also use the Event API over emitting events via a traditional
trask marked this conversation as resolved.
Show resolved Hide resolved
logging library since it avoid accidentally emitting (non-event) traditional logs.

Also, recommending the Event API over emitting events via a traditional logging library makes for a clearer overall
OpenTelemetry API story - with first class user facing APIs for traces, metrics, and events,
all suitable for using directly in native instrumentation.

### SDK

The Event SDK needs to support two destinations for events:

* OpenTelemetry Logging SDK
trask marked this conversation as resolved.
Show resolved Hide resolved
* Language-specific logging libraries

## Trade-offs and mitigations

TODO
trask marked this conversation as resolved.
Show resolved Hide resolved

## Prior art and alternatives

TODO
trask marked this conversation as resolved.
Show resolved Hide resolved

## Open questions

TODO
trask marked this conversation as resolved.
Show resolved Hide resolved

## Future possibilities
trask marked this conversation as resolved.
Show resolved Hide resolved

The Event API will probably need an `IsEnabled` function based on severity level, scope name, and event name.
trask marked this conversation as resolved.
Show resolved Hide resolved