Skip to content

Add support for samplers to modify Tracestate#3610

Merged
cijothomas merged 11 commits intoopen-telemetry:mainfrom
cijothomas:cijothomas/tracestatesampelr
Aug 29, 2022
Merged

Add support for samplers to modify Tracestate#3610
cijothomas merged 11 commits intoopen-telemetry:mainfrom
cijothomas:cijothomas/tracestatesampelr

Conversation

@cijothomas
Copy link
Copy Markdown
Member

@cijothomas cijothomas commented Aug 27, 2022

Fixes #1708
To maintain backward compatibility, SamplingResult will default to null for TraceStateString. Any non-null value set by samplers, will be set as the tracestate of the created activity.
If sampler intents to not modify tracestate, it can return null. (Default)
Else, it can populate tracestate with desired value.
Given tracestate is implemented as a opaque string, the samper is responsible for ensuring the tracestate semantics are followed.

@cijothomas cijothomas requested a review from a team August 27, 2022 06:15
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 27, 2022

Codecov Report

Merging #3610 (745a9c6) into main (e6d39b8) will decrease coverage by 0.07%.
The diff coverage is 86.95%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3610      +/-   ##
==========================================
- Coverage   87.22%   87.14%   -0.08%     
==========================================
  Files         280      280              
  Lines       10056    10073      +17     
==========================================
+ Hits         8771     8778       +7     
- Misses       1285     1295      +10     
Impacted Files Coverage Δ
src/OpenTelemetry/Trace/SamplingResult.cs 88.57% <80.00%> (-11.43%) ⬇️
src/OpenTelemetry/Trace/TracerProviderSdk.cs 99.23% <100.00%> (+0.40%) ⬆️
...entation/ExportClient/OtlpGrpcTraceExportClient.cs 50.00% <0.00%> (-28.58%) ⬇️
...xporter.OpenTelemetryProtocol/OtlpTraceExporter.cs 59.09% <0.00%> (-18.19%) ⬇️
...metryProtocol/Implementation/ActivityExtensions.cs 91.75% <0.00%> (-3.30%) ⬇️
...tpListener/Internal/PrometheusCollectionManager.cs 78.04% <0.00%> (-2.44%) ⬇️
...nTelemetry/Internal/OpenTelemetrySdkEventSource.cs 77.50% <0.00%> (+0.83%) ⬆️
....Prometheus.HttpListener/PrometheusHttpListener.cs 82.66% <0.00%> (+4.00%) ⬆️
... and 3 more

Comment thread src/OpenTelemetry/Trace/SamplingResult.cs Outdated
Comment thread src/OpenTelemetry/Trace/SamplingResult.cs Outdated
Copy link
Copy Markdown
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added couple minor suggestions.
LGTM with a changelog entry.

@cijothomas cijothomas merged commit b54cc80 into open-telemetry:main Aug 29, 2022
@cijothomas cijothomas deleted the cijothomas/tracestatesampelr branch August 29, 2022 23:36
@@ -42,6 +43,7 @@ public SamplingResult(bool isSampled)
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not need an overload for this one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its optional. if there is a need, we can always add more overloads in future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Samplers should be allowed to modify tracestate

4 participants