-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement span processor's OnEnding #5756
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
Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
440d0b1
implement span processor's OnEnding
dmathieu 999175e
add changelog entry
dmathieu fb6bba5
move the OnEnding processor into internal/x
dmathieu 5b53cc5
add a bit more doc
dmathieu 34a68be
Merge branch 'main' into span-onending
dmathieu 793d5fd
Update sdk/trace/internal/x/onending_processor.go
dmathieu 3613902
Update sdk/trace/internal/x/onending_processor.go
dmathieu 6c04318
add readme
dmathieu 675b6f4
Merge branch 'main' into span-onending
dmathieu 67a67f0
Merge branch 'main' into span-onending
dmathieu c7fe407
Merge branch 'main' into span-onending
dmathieu 27565c9
Merge branch 'main' into span-onending
dmathieu 2537c50
Merge branch 'main' into span-onending
dmathieu 80c873a
bring back mutex lock in IsRecording
dmathieu 43e3438
Merge branch 'main' into span-onending
dmathieu f4ae0f4
avoid locking twice if there are no onending span processors
dmathieu 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
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,33 @@ | ||
# Experimental Features | ||
|
||
The Trace SDK contains features that have not yet stabilized. | ||
These features are added to the OpenTelemetry Go Trace SDK prior to | ||
stabilization so that users can start experimenting with them and provide | ||
feedback. | ||
|
||
These feature may change in backwards incompatible ways as feedback is applied. | ||
See the [Compatibility and Stability](#compatibility-and-stability) section for | ||
more information. | ||
|
||
## Features | ||
|
||
- [OnEnding Processor](#onending-processor) | ||
|
||
### OnEnding Processor | ||
|
||
Processor implementations sometimes want to be able to modify a span after it | ||
ended, but before it becomes immutable. | ||
A processor that implements the `OnEnding` method can use that callback to | ||
perform such modifications. | ||
|
||
It can be used to implement tail-based sampling for example. | ||
|
||
## Compatibility and Stability | ||
|
||
Experimental features do not fall within the scope of the OpenTelemetry Go | ||
versioning and stability [policy](../../../../VERSIONING.md). | ||
These features may be removed or modified in successive version releases, | ||
including patch versions. | ||
|
||
When an experimental feature is promoted to a stable feature, a migration path | ||
will be included in the changelog entry of the release. |
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,25 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package x // import "go.opentelemetry.io/otel/sdk/trace/internal/x" | ||
|
||
import "go.opentelemetry.io/otel/trace" | ||
|
||
// OnEndingSpanProcessor represents span processors that allow mutating spans | ||
// just before they are ended and made immutable. | ||
// | ||
// This is useful for custom processor implementations that want to mutate | ||
// spans when they are finished, and before they are made immutable, such as | ||
// implementing tail-based sampling. | ||
type OnEndingSpanProcessor interface { | ||
// OnEnding is called while the span is finished, and spans are still | ||
// mutable. | ||
// | ||
// This method is called synchronously during the span's End operation, | ||
// therefore it should not block or throw an exception. | ||
// If multiple [SpanProcessor] are registered, their OnEnding callbacks are | ||
// invoked in the order they have been registered. | ||
// | ||
// [SpanProcessor]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#SpanProcessor | ||
OnEnding(trace.Span) | ||
} |
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
Oops, something went wrong.
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.