-
Notifications
You must be signed in to change notification settings - Fork 916
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
lmolkova
merged 61 commits into
open-telemetry:main
from
trask:span-event-migration-plan
Apr 25, 2025
Merged
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 79d6fb3
refinement
trask 22663be
Merge remote-tracking branch 'upstream/main' into span-event-migratio…
trask ad8af01
details
trask 8a276ac
exceptions and SDK config
trask e859a64
Update oteps/4430-span-event-deprecation-plan.md
trask fa814c0
Update oteps/4430-span-event-deprecation-plan.md
trask 5a802b6
Update oteps/4430-span-event-deprecation-plan.md
trask c2765cb
Update oteps/4430-span-event-deprecation-plan.md
trask 1d3f289
link to prototype
trask 0fcf5a2
explanation
trask 29e8c50
future possibility
trask 516fbca
another future possibility
trask 43c6015
communication plan
trask 9bbe6c8
another future possibility
trask 7aba87c
link
trask 8a79e4c
new plan for span-terminating exceptions
trask 777df40
reorg
trask 4fd7067
lint
trask 7159104
timeline already covered by policy
trask dcdb1e1
feedback
trask 71880fc
across otel repos
trask f37aaaf
rationale in blog post
trask 55a3e75
Merge remote-tracking branch 'upstream/main' into span-event-migratio…
trask 58924d9
don't deprecate proto
trask 5c72828
wording
trask 9634e3a
add link to definition of deprecated
trask 44bc3f0
clarify
trask 6cbdbcc
fix
trask 7ee123c
clarify heading
trask 48ff6cb
span event -> span event api deprecation plan
trask 0dcfb68
fix link
trask 6b6c7c9
split intro section
trask 92a2150
cleanup
trask 7f31bcc
cleanup
trask b4ec875
cleanup
trask 9f64424
cleanup
trask 0b01cd0
cleanup
trask 3018819
cleanup
trask 0a21a4b
cleanup
trask 63ba226
cleanup
trask 62b09e4
cleanup
trask b5ff9e6
cleanup
trask 5ea7832
Update oteps/4430-span-event-api-deprecation-plan.md
trask f170a81
nice to have
trask add04b5
small reorg
trask a11f016
Update 4430-span-event-api-deprecation-plan.md
trask 04daafc
Update oteps/4430-span-event-api-deprecation-plan.md
trask 35e86ea
event api -> logs api
trask fcae1e0
remove span-terminating exceptions
trask e836bc6
fix ref
trask 8db1a53
remove outdated line
trask 8337009
Open questions about exception stabilization
trask b7d37fd
Explain span attribute use case
trask 72a5844
lint
trask 8507c05
Merge branch 'main' into span-event-migration-plan
pellared a910839
Merge branch 'main' into span-event-migration-plan
trask 16e74a3
Merge branch 'main' into span-event-migration-plan
trask 32fb325
Merge remote-tracking branch 'upstream/main' into span-event-migratio…
trask bf68fa5
clarify that exceptions are include in backcompat story too
trask 890f0e1
fix link
trask File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
trask marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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. | ||
cijothomas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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, | ||
trask marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
trask marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[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 | ||
trask marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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) | ||
trask marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.