Add event.data attribute to provide mapping from span events to events#954
Add event.data attribute to provide mapping from span events to events#954lmolkova wants to merge 6 commits intoopen-telemetry:mainfrom
event.data attribute to provide mapping from span events to events#954Conversation
event.body attribute to provide mapping from span events to proper eventsevent.body attribute to provide mapping from span events to events
|
This makes sense as a way to define recording events as span events. Even once events are stable, there will still be cases where end users want the SDK/Collector to record events that have a span context attached as span events, so this is useful in the long term. |
4043778 to
5e76492
Compare
event.body attribute to provide mapping from span events to eventsevent.data attribute to provide mapping from span events to events
| | Attribute | Type | Description | Examples | Stability | | ||
| |---|---|---|---|---| | ||
| | `event.name` | string | Identifies the class / type of event. [1] | `browser.mouse.click`; `device.app.lifecycle` |  | | ||
| | `event.data` | string | The event payload serialized into JSON string. [1] | `{"role":"user","content":"how to use OTel Event API?"}`; `"plain string"` |  | |
There was a problem hiding this comment.
If this is aligned with the Body semantics of a LogRecord, why is it a string and not Any? Even in #880 there is no strict requirement that it needs to be JSON.
There was a problem hiding this comment.
Attribute values within OTel will not support Any https://github.com/open-telemetry/opentelemetry-specification/tree/v1.31.0/specification/common#attribute
I was curious about this, do you have scenarios in mind where this would be helpful/needed? Thanks |
Well, we have a few places where this pattern is used already - gRPC instrumentation jumps to mind. I've personally demonstrated span events in modeling a streaming operation by creating events as part of a callback to consume data from a stream -- |
I'm hoping we can migrate gRPC semantic conventions to use (log-based) events. We discussed in semconv meeting that there should be a way for users to opt into emitting log-based events as span events in the short term until backends (e.g. Jaeger) support log-based events. |
|
The existing span events (all but exceptions) can be mapped to log-based events without introducing Based on the discussions in the Spec and Semconv WG, we'd try to leverage Event API (or log API in the short term) to emit events with body instead of adding mapping to span events. The attribute like So I'm going to close this PR. |
Related to #829, #695, open-telemetry/opentelemetry-specification#3406
Changes
In GenAI WG, we'd like to be able to document semantic conventions for events, prototype and ship instrumentation libraries that emit them.
Event API is not available in the majority of languages yet, log are also still in development in many of them and the instrumentation libraries should not use logging bridge and produce log records anyway.
As explained in #829, we'd like to record events payload as if they were reported with Event API, but record them as span events until Event API is widely available.
This PR introduces
event.bodyattribute that can be used to report event payload on a span event (available and stable everywhere).The attribute records the payload as a JSON string.
Note that a
"plain string"is a valid JSON - see RFC 7159TODO
Merge requirement checklist
[chore]schema-next.yaml updated with changes to existing conventions.