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

Add ability for SpanProcessor to mutate spans on end #4024

Merged
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1722053
Clarified approach on how to extend SDK plugin interfaces
JonasKunz Apr 30, 2024
a4b411a
Added onEnding method to SpanProcessor
JonasKunz Apr 30, 2024
600c721
wording
JonasKunz Apr 30, 2024
1d3543d
Added changelog
JonasKunz Apr 30, 2024
d60594f
linting
JonasKunz Apr 30, 2024
6bf8266
more linting
JonasKunz Apr 30, 2024
19d5a77
Add experimental status
JonasKunz May 2, 2024
5bcce33
Merge remote-tracking branch 'otel/main' into spanprocessor-end-mutat…
JonasKunz May 2, 2024
598a9eb
Removed paragraph about SDK interface extensions
JonasKunz May 2, 2024
e34d828
Merge remote-tracking branch 'otel/main' into spanprocessor-end-mutat…
JonasKunz May 8, 2024
81bef44
Remove accidental merge leftover
JonasKunz May 8, 2024
b56fbb9
Disallow concurrent updates, specify invocation order
JonasKunz May 14, 2024
f54293d
Merge remote-tracking branch 'otel/main' into spanprocessor-end-mutat…
JonasKunz May 14, 2024
990c91a
Linting
JonasKunz May 14, 2024
e38a16d
Merge remote-tracking branch 'otel/main' into spanprocessor-end-mutat…
JonasKunz May 16, 2024
2cf024a
Update specification/trace/sdk.md
JonasKunz May 23, 2024
ae572ca
Apply suggestions from code review
JonasKunz May 24, 2024
303c8c2
Merge remote-tracking branch 'otel/main' into spanprocessor-end-mutat…
JonasKunz May 27, 2024
4d8422a
Merge remote-tracking branch 'otel/main' into spanprocessor-end-mutat…
JonasKunz Jun 5, 2024
218783f
Apply suggestions from code review
JonasKunz Jun 5, 2024
1a385b5
Merge branch 'main' into spanprocessor-end-mutations
JonasKunz Jun 7, 2024
b0f776c
Merge branch 'main' into spanprocessor-end-mutations
JonasKunz Jun 13, 2024
d680966
Merge branch 'main' into spanprocessor-end-mutations
JonasKunz Jun 19, 2024
1e5c7fa
Fix changelog after merge
JonasKunz Jun 19, 2024
ffcb614
Marked SpanProcessor.OnEnding as optional
JonasKunz Jun 26, 2024
7cdc995
Add to compliance matrix
JonasKunz Jun 26, 2024
a72ea8f
lint fix
JonasKunz Jun 26, 2024
fe34f57
Added missing methods, adjust formatting
JonasKunz Jun 27, 2024
a8da098
Merge remote-tracking branch 'otel/main' into spanprocessor-end-mutat…
JonasKunz Jun 27, 2024
afe1eec
Merge remote-tracking branch 'otel/main' into spanprocessor-end-mutat…
JonasKunz Jul 4, 2024
a97ca5f
Merge branch 'main' into spanprocessor-end-mutations
JonasKunz Jul 12, 2024
70f91d9
Merge branch 'main' into spanprocessor-end-mutations
JonasKunz Jul 12, 2024
6449448
Merge branch 'main' into spanprocessor-end-mutations
JonasKunz Jul 15, 2024
4997436
Review fixes
JonasKunz Jul 15, 2024
47854c9
Merge branch 'main' into spanprocessor-end-mutations
pellared Jul 15, 2024
1f75e17
Merge branch 'main' into spanprocessor-end-mutations
JonasKunz Jul 16, 2024
786ff95
Merge branch 'main' into spanprocessor-end-mutations
JonasKunz Jul 17, 2024
f246ff6
Merge branch 'main' into spanprocessor-end-mutations
JonasKunz Jul 24, 2024
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: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ release.

### Traces

- Add `OnEnding` callback to SDK `SpanProcessor` interface
JonasKunz marked this conversation as resolved.
Show resolved Hide resolved
([#4024](https://github.com/open-telemetry/opentelemetry-specification/pull/4024))
JonasKunz marked this conversation as resolved.
Show resolved Hide resolved

### Metrics

### Logs
Expand Down
23 changes: 22 additions & 1 deletion specification/trace/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ linkTitle: SDK
- [Span processor](#span-processor)
* [Interface definition](#interface-definition)
+ [OnStart](#onstart)
+ [OnEnding](#onending)
+ [OnEnd(Span)](#onendspan)
+ [Shutdown()](#shutdown)
+ [ForceFlush()](#forceflush)
Expand Down Expand Up @@ -565,7 +566,8 @@ in the SDK:

`OnStart` is called when a span is started. This method is called synchronously
on the thread that started the span, therefore it should not block or throw
exceptions.
exceptions. If multiple `SpanProcessors` are registered, their `OnStart` callbacks
are invoked in the order they have been registered.

**Parameters:**

Expand All @@ -580,6 +582,25 @@ exceptions.

**Returns:** `Void`

#### OnEnding
JonasKunz marked this conversation as resolved.
Show resolved Hide resolved
JonasKunz marked this conversation as resolved.
Show resolved Hide resolved

**Status**: [Experimental](../document-status.md)
JonasKunz marked this conversation as resolved.
Show resolved Hide resolved

`OnEnding` is called just before a span is ended. The span is still mutable, but the end timestamp is already set.
jack-berg marked this conversation as resolved.
Show resolved Hide resolved
JonasKunz marked this conversation as resolved.
Show resolved Hide resolved
This method MUST be called synchronously within the [`Span.End()` API](api.md#end),
therefore it should not block or throw an exception.
jack-berg marked this conversation as resolved.
Show resolved Hide resolved
If multiple `SpanProcessors` are registered, their `OnEnding` callbacks
are invoked in the order they have been registered.
The SDK MUST guarantee that the span cannot be modified anymore by any other thread
JonasKunz marked this conversation as resolved.
Show resolved Hide resolved
before invoking `OnEnding` of the first `SpanProcessor`. From that point on, modifications
are only allowed synchronously from within the invoked `OnEnding` callbacks.
JonasKunz marked this conversation as resolved.
Show resolved Hide resolved

**Parameters:**

* `span` - a [read/write span object](#additional-span-interfaces) for the span which is about to be ended.

**Returns:** `Void`

#### OnEnd(Span)

`OnEnd` is called after a span is ended (i.e., the end timestamp is already set).
Expand Down
Loading