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 15 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
69 changes: 69 additions & 0 deletions text/0265-event-vision.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Event Basics

## Motivation

The introduction of Events has been contentious, so we want to document and agree on a few basics.

### What are OpenTelemetry Events?

OpenTelemetry Events are a type of OpenTelemetry Log that requires an event name and follows a specific structure implied by that event name.

They are a core concept in OpenTelemetry Semantic Conventions.

### OTLP

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

### API

OpenTelemetry should provide a (user-facing) Log API that includes the capability to emit OpenTelemetry Events.
trask marked this conversation as resolved.
Show resolved Hide resolved

### Interoperability with Generic Logging Libraries

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

It should also be possible to bypass the OpenTelemetry Log API entirely and emit OpenTelemetry Logs (including Events)
trask marked this conversation as resolved.
Show resolved Hide resolved
directly via existing language-specific logging libraries, if that library has the capability to do so.

OpenTelemetry will recommend that
[instrumentation libraries](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/glossary.md#instrumentation-library)
use the OpenTelemetry Log API to emit OpenTelemetry Events rather than using a generic logging library. This recommendation aims to provide users with a simple and consistent
onboarding experience that avoids mixing approaches.

OpenTelemetry will also recommend that application developers use the OpenTelemetry Log API to emit OpenTelemetry Events instead of using a generic
logging library, as this helps prevent accidentally emitting logs that lack an event name or are unstructured.

Recommending the OpenTelemetry Log API for emitting OpenTelemetry Events, rather than using a generic logging library, contributes to a clearer overall
trask marked this conversation as resolved.
Show resolved Hide resolved
OpenTelemetry API story. This ensures a unified approach with first-class user-facing APIs for traces, metrics, and events,
trask marked this conversation as resolved.
Show resolved Hide resolved
all suitable for direct use in native instrumentation.

### Relationship to Span Events

Events are intended to replace Span Events in the long term.
Span Events will be deprecated to signal that users should prefer Events.
trask marked this conversation as resolved.
Show resolved Hide resolved

Interoperability between Events and Span Events will be defined in the short term.

### SDK

This refers to the existing OpenTelemetry Log SDK.

## Open questions

* How to support routing logs from the Log API to a language-specific logging library
trask marked this conversation as resolved.
Show resolved Hide resolved
while simultaneously routing logs from the language-specific logging library to an OpenTelemetry Logging Exporter?
trask marked this conversation as resolved.
Show resolved Hide resolved
* How do log bodies interoperate with generic logging libraries?
trask marked this conversation as resolved.
Show resolved Hide resolved
OpenTelemetry Logs have two places to put structure (attributes and body), while often logging libraries only have one layer of structure,
which makes it non-obvious how to do a two-way mapping between them in this case.
* How do event bodies interoperate with Span Events?

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

* The Log API may need an `IsEnabled` function based on severity level, scope name, and event name.
* Ergonomic improvements.
* Capturing raw metric events as opposed to aggregating and emitting them as OpenTelemetry Metric data
(e.g. [opentelemetry-specification/617](https://github.com/open-telemetry/opentelemetry-specification/issues/617)).
trask marked this conversation as resolved.
Show resolved Hide resolved
* Capturing raw span events as opposed to aggregating and emitting them as OpenTelemetry Span data
(e.g. a [streaming SDK](https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-specification+%22streaming+sdk%22&type=issues)).
* Capturing events and computing metrics from them.