-
Notifications
You must be signed in to change notification settings - Fork 497
Add export_unsampled_spans opt-in feature with OpenTelemetry specification compliance by default #3612
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
Draft
Copilot
wants to merge
14
commits into
main
Choose a base branch
from
copilot/fix-3610
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add export_unsampled_spans opt-in feature with OpenTelemetry specification compliance by default #3612
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
06f1fdf
Initial plan
Copilot 745aec7
Implement export_unsampled_spans feature for span processors
Copilot 761e20b
Add documentation for export_unsampled_spans feature
Copilot 1248f76
Add demo example and finalize export_unsampled_spans implementation
Copilot a7f0439
Merge branch 'main' into copilot/fix-3610
lalitb cbee80d
Fix copyright header in unsampled_spans_demo.cc
Copilot 07cbc81
Merge branch 'main' into copilot/fix-3610
lalitb 69a0f1c
Add unsampled_spans_demo to CMake build system
Copilot 4ed9a10
Remove export_unsampled_spans feature to ensure OpenTelemetry specifi…
Copilot 037e44d
Restore export_unsampled_spans as opt-in feature maintaining spec com…
Copilot a5ce117
Remove markdown documentation and example for export_unsampled_spans …
Copilot 9807879
Merge branch 'main' into copilot/fix-3610
lalitb a0dbb94
Fix missing newline at end of simple_processor_options.h file
Copilot 815e9ab
Merge branch 'main' into copilot/fix-3610
lalitb 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
32 changes: 32 additions & 0 deletions
32
sdk/include/opentelemetry/sdk/trace/simple_processor_options.h
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,32 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#include "opentelemetry/version.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk | ||
{ | ||
|
||
namespace trace | ||
{ | ||
|
||
/** | ||
* Struct to hold simple SpanProcessor options. | ||
*/ | ||
struct SimpleSpanProcessorOptions | ||
{ | ||
/** | ||
* Whether to export unsampled but recording spans. | ||
* By default, only sampled spans (Decision::RECORD_AND_SAMPLE) are exported to maintain | ||
* OpenTelemetry specification compliance. | ||
* When set to true, unsampled recording spans (Decision::RECORD_ONLY) are also exported, | ||
* which intentionally violates the OpenTelemetry specification. | ||
*/ | ||
bool export_unsampled_spans = false; | ||
}; | ||
|
||
} // namespace trace | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE |
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.
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.
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.
Doesn’t look like there was an IsSampled() check before this PR — so were we effectively exporting all recording spans (sampled + unsampled) to the exporter before this change?
Uh oh!
There was an error while loading. Please reload this page.
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 so, this is what I see from the code:
What the Spec Says:
RECORD_ONLY
spans (IsRecording=true, Sampled=false) should go to Span Processors but NOT to Span ExportersRECORD_AND_SAMPLE
spans should reach exportersWhat the C++ SDK Does:
RECORD_ONLY
spans create real spans with recordablesOnEnd()
BatchSpanProcessor
) pass them to exporters viaexporter_->Export()
I believe we can use this PR to fix that too. @copilot please see if we are compliant with specs as indicated above with this PR.