Skip to content

OTEP: Span Event API deprecation plan #4430

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

Merged
merged 61 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
db7164d
Span event migration plan
trask Feb 24, 2025
79d6fb3
refinement
trask Feb 24, 2025
22663be
Merge remote-tracking branch 'upstream/main' into span-event-migratio…
trask Feb 24, 2025
ad8af01
details
trask Feb 25, 2025
8a276ac
exceptions and SDK config
trask Feb 25, 2025
e859a64
Update oteps/4430-span-event-deprecation-plan.md
trask Feb 25, 2025
fa814c0
Update oteps/4430-span-event-deprecation-plan.md
trask Feb 25, 2025
5a802b6
Update oteps/4430-span-event-deprecation-plan.md
trask Feb 25, 2025
c2765cb
Update oteps/4430-span-event-deprecation-plan.md
trask Feb 26, 2025
1d3f289
link to prototype
trask Feb 27, 2025
0fcf5a2
explanation
trask Feb 27, 2025
29e8c50
future possibility
trask Feb 27, 2025
516fbca
another future possibility
trask Feb 27, 2025
43c6015
communication plan
trask Feb 27, 2025
9bbe6c8
another future possibility
trask Feb 27, 2025
7aba87c
link
trask Feb 27, 2025
8a79e4c
new plan for span-terminating exceptions
trask Feb 27, 2025
777df40
reorg
trask Feb 27, 2025
4fd7067
lint
trask Feb 27, 2025
7159104
timeline already covered by policy
trask Feb 27, 2025
dcdb1e1
feedback
trask Feb 28, 2025
71880fc
across otel repos
trask Feb 28, 2025
f37aaaf
rationale in blog post
trask Feb 28, 2025
55a3e75
Merge remote-tracking branch 'upstream/main' into span-event-migratio…
trask Mar 4, 2025
58924d9
don't deprecate proto
trask Mar 4, 2025
5c72828
wording
trask Mar 4, 2025
9634e3a
add link to definition of deprecated
trask Mar 4, 2025
44bc3f0
clarify
trask Mar 5, 2025
6cbdbcc
fix
trask Mar 5, 2025
7ee123c
clarify heading
trask Mar 5, 2025
48ff6cb
span event -> span event api deprecation plan
trask Mar 5, 2025
0dcfb68
fix link
trask Mar 5, 2025
6b6c7c9
split intro section
trask Mar 5, 2025
92a2150
cleanup
trask Mar 5, 2025
7f31bcc
cleanup
trask Mar 5, 2025
b4ec875
cleanup
trask Mar 5, 2025
9f64424
cleanup
trask Mar 5, 2025
0b01cd0
cleanup
trask Mar 5, 2025
3018819
cleanup
trask Mar 5, 2025
0a21a4b
cleanup
trask Mar 5, 2025
63ba226
cleanup
trask Mar 5, 2025
62b09e4
cleanup
trask Mar 5, 2025
b5ff9e6
cleanup
trask Mar 5, 2025
5ea7832
Update oteps/4430-span-event-api-deprecation-plan.md
trask Mar 5, 2025
f170a81
nice to have
trask Mar 5, 2025
add04b5
small reorg
trask Mar 5, 2025
a11f016
Update 4430-span-event-api-deprecation-plan.md
trask Mar 18, 2025
04daafc
Update oteps/4430-span-event-api-deprecation-plan.md
trask Mar 18, 2025
35e86ea
event api -> logs api
trask Mar 19, 2025
fcae1e0
remove span-terminating exceptions
trask Mar 19, 2025
e836bc6
fix ref
trask Mar 19, 2025
8db1a53
remove outdated line
trask Mar 19, 2025
8337009
Open questions about exception stabilization
trask Mar 19, 2025
b7d37fd
Explain span attribute use case
trask Mar 19, 2025
72a5844
lint
trask Mar 19, 2025
8507c05
Merge branch 'main' into span-event-migration-plan
pellared Apr 10, 2025
a910839
Merge branch 'main' into span-event-migration-plan
trask Apr 15, 2025
16e74a3
Merge branch 'main' into span-event-migration-plan
trask Apr 22, 2025
32fb325
Merge remote-tracking branch 'upstream/main' into span-event-migratio…
trask Apr 24, 2025
bf68fa5
clarify that exceptions are include in backcompat story too
trask Apr 24, 2025
890f0e1
fix link
trask Apr 25, 2025
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
3 changes: 2 additions & 1 deletion oteps/0265-event-vision.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ all suitable for direct use in native instrumentation.
Events are intended to replace Span Events in the long term.
Span Events will be deprecated to signal that users should prefer Events.

Interoperability between Events and Span Events will be defined in the short term.
See [OTEP 4430: Span Event API deprecation plan](4430-span-event-api-deprecation-plan.md)
for more details.

### SDK

Expand Down
135 changes: 135 additions & 0 deletions oteps/4430-span-event-api-deprecation-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Span Event API deprecation plan

## Motivation

[OTEP 265: Event Vision](0265-event-vision.md) states that we intend to
deprecate Span Events in favor of (log-based) Events.

After further discussions, we are only planning to deprecate the Span Event
API, while retaining the ability to emit Span Events via the Logs API.

This achieves the primary goal of deprecation, which is to provide a single
consistent guidance to instrumentation authors to use the Logs API when
emitting events, while still supporting use cases that rely on Span Events
being emitted in the same proto envelope as their containing span.

## The plan

### In the proto

Stabilize (log-based) Events.

### In the Specification

1. Stabilize emitting exceptions and events via the Logs API.

This will allow recording exceptions and events using the Logs API,
instead of recording them using the Span Event API.

Note: emitting exceptions via the Logs API is
[already stable](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/exceptions/exceptions-logs.md#semantic-conventions-for-exceptions-in-logs),
but there are a couple of open questions that need to be addressed:

- Do we want to specify some kind of convenience function on Logs
similar to RecordException?
- Do we want to recommend that log-based exceptions do anything
specific with the event name field?

2. Mark [Span RecordException](../specification/trace/api.md#record-exception)
as [Deprecated](../specification/document-status.md#lifecycle-status),
recommending instead that exceptions are recorded using the Logs API.

3. Mark [Span AddEvent](../specification/trace/api.md#add-events)
as [Deprecated](../specification/document-status.md#lifecycle-status),
recommending instead that events are recorded using the Logs API.

This can be done in parallel with 2.

### Per API and SDK

1. Implement and stabilize emitting exceptions and events via the Logs API.

2. Implement the SDK-based backcompat story:

- [Sending (log-based) exceptions and Events as Span Events](#via-the-sdk)

3. Mark
[Span RecordException](../specification/trace/api.md#record-exception)
as [Deprecated](../specification/document-status.md#lifecycle-status),
recommending instead that exceptions are recorded using the Logs API.

4. Mark [Span AddEvent](../specification/trace/api.md#add-events)
as [Deprecated](../specification/document-status.md#lifecycle-status),
recommending instead that events are recorded using the Logs API.

This can be done in parallel with 3.

### Per Instrumentation

For [stable](../specification/versioning-and-stability.md#stable)
instrumentations that are using
[Span RecordException](../specification/trace/api.md#record-exception)
and [Span AddEvent](../specification/trace/api.md#add-events):

- In the instrumentation's current major version
- It SHOULD continue to use these
- In the instrumentation's next major version
- It SHOULD stop using these,
instead recording exceptions and events using the Logs API.
- Users will be able to retain the prior telemetry output by opting in to
[Sending (log-based) exceptions and Events as Span Events](#sending-log-based-exceptions-and-events-as-span-events)
- In case the instrumentation was using span events previously to record
additional details about a span (i.e. details that don't need a timestamp),
it SHOULD instead record these details as attributes on the span. See
[semantic-conventions#2010](https://github.com/open-telemetry/semantic-conventions/issues/2010)
and
[opentelemetry-specification#4446](https://github.com/open-telemetry/opentelemetry-specification/issues/4446)
for more details about this case.

Non-stable instrumentations SHOULD use their best judgement on whether to follow
the above guidance.

## Sending (log-based) exceptions and Events as Span Events

### Via the SDK

There MUST be a way to send (log-based) exceptions and Events as Span Events
for use cases that rely on Span Events being emitted in the
same proto envelope as their containing span, and for users
who need to preserve the prior behavior when updating to
new instrumentation.

This mechanism SHOULD be implemented as follows (see
[prototype](https://github.com/open-telemetry/opentelemetry-java-contrib/blob/80adbe1cf8de647afa32c68f921aef2bbd4dfd71/processors/README.md#event-to-spanevent-bridge)):

- An SDK-based log processor that converts exception and Event records to Span Events
and attaches them to the current span, whose behavior and configuration
are defined in the OpenTelemetry Specification.
- A standard way to add this log processor via declarative configuration
(assuming its package has been installed).

Users can add a batch log record processor and log exporter depending on
if they also want to export exception and Event records as logs or not.

This log processor SHOULD be included in the standard
OpenTelemetry zero-code distribution (if one exists for the language).

### Via the Collector

Note: this is a nice-to-have only and not required for any other part
of the Span Event API deprecation plan.

This mechanism MAY be implemented as follows:

- A Collector-based processor that buffers spans and moves (log-based)
Events to the appropriate span.

This log processor MAY be included in the standard
OpenTelemetry Collector Contrib distribution.

## Communication plan

Publish a blog post if/when this OTEP is accepted, giving readers a way to
provide feedback (e.g. pointing to a specification issue where we are
gathering feedback). The blog post should include the rationale for the
decision to deprecate the Span Event API.