-
Notifications
You must be signed in to change notification settings - Fork 850
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
Added SpanProcessor OnEnding callback #6367
Merged
jack-berg
merged 18 commits into
open-telemetry:main
from
JonasKunz:span-processor-beforeEnd
Sep 4, 2024
Merged
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f257438
Implemented beforeEnd callback
JonasKunz 55f5244
Rename to onEnding
JonasKunz 528727f
Merge remote-tracking branch 'otel/main' into span-processor-beforeEnd
JonasKunz 046cbe8
Merge remote-tracking branch 'otel/HEAD' into span-processor-beforeEnd
JonasKunz f3fd785
spotless and documentation clarifications
JonasKunz c7ed970
Added jApiCMp output
JonasKunz 2b0c31e
Merge remote-tracking branch 'otel/HEAD' into span-processor-beforeEnd
JonasKunz d623112
Prevent concurrent modifications from other threads instead of holdin…
JonasKunz 78e715b
Moved onEnding to ExtendedSpanProcessor interface
JonasKunz 5e1f295
Merge remote-tracking branch 'otel/HEAD' into span-processor-beforeEnd
JonasKunz 40f1cef
Fixed string representation test
JonasKunz 2f686cf
Apply suggestions from code review
JonasKunz 300b44c
Review fixes
JonasKunz c3b8784
Fix javadoc
JonasKunz 8240cab
Added test case to demonstrate usage
JonasKunz 4aa663c
Apply suggestions from code review
JonasKunz fc67a4d
Make test method package private
JonasKunz 80aa059
Invert isSpanUnmodifiableByCurrentThread
JonasKunz 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 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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
Comparing source compatibility of opentelemetry-sdk-trace-1.41.0-SNAPSHOT.jar against opentelemetry-sdk-trace-1.40.0.jar | ||
No changes. | ||
*** MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.sdk.trace.SpanProcessor (not serializable) | ||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0 | ||
+++ NEW METHOD: PUBLIC(+) boolean isOnEndingRequired() | ||
+++ NEW METHOD: PUBLIC(+) void onEnding(io.opentelemetry.sdk.trace.ReadWriteSpan) |
This file contains 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 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 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 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's probably a mistake to be calling this under the lock. I believe we only want to do internal state management while the lock is being held, not call not-under-our-control methods provided by users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lock was actually intentionally hold to cover this part of the spec:
This part was added to the spec so that SpanProcessors can be sure that the state they see the span in is actually consistent and not prone to race conditions due to span modifications from the application code.
However, I now switched to a different way of implementing this, because as you said exposing the lock is probably not the best way of achieving the desired safety here.