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

Create an activity even when SamplingDecision is Drop #1715

Closed

Conversation

utpilla
Copy link
Contributor

@utpilla utpilla commented Jan 21, 2021

Fixes #1709.

Changes

  • Return ActivitySamplingResult.Propagation when SamplingDecision is Drop and the activity is not root
  • This is to comply with the spec requirement of always creating a span regardless of the Sampling Decision

@utpilla utpilla requested a review from a team January 21, 2021 21:31
@codecov
Copy link

codecov bot commented Jan 21, 2021

Codecov Report

Merging #1715 (0f5491e) into master (02adc4c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1715   +/-   ##
=======================================
  Coverage   82.18%   82.18%           
=======================================
  Files         250      250           
  Lines        6763     6758    -5     
=======================================
- Hits         5558     5554    -4     
+ Misses       1205     1204    -1     
Impacted Files Coverage Δ
src/OpenTelemetry/Trace/TracerProviderSdk.cs 89.76% <100.00%> (-0.39%) ⬇️
...Telemetry/Internal/SelfDiagnosticsEventListener.cs 94.28% <0.00%> (+1.42%) ⬆️

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

While this gets us closer to the spec, it creates an additional issue of broken traces.
If A->B->C, and A,C sampling decision is Record&Sampler, but B is Drop. If we create new Activity for B, and C considers B as its parent, then we'll not be able to stitch together A->C in backends, as C's parent is B, which is not stored anywhere.

This can be alleviated, but it requires us to device a strategy. Most likely this requires help from .net runtime as well.
https://github.com/open-telemetry/opentelemetry-specification/pull/998/files#r517616726

@CodeBlanch
Copy link
Member

Something seems off about this. Looks like the current behavior is we create the root but not children. That's great for perf. Could the problem be in the instrumentation?

@cijothomas
Copy link
Member

Something seems off about this. Looks like the current behavior is we create the root but not children. That's great for perf. Could the problem be in the instrumentation?

The current issue is - we are not in compliance with the spec, as spec says "a new Span with new SpanId must be created irrespective of Sampling outcome.". To make us compliant with that part of the spec, we need to create an Activity always with PropagationData only. This ensure new SpanId is generated. But this causes broken trace. Some of these were discussed in https://github.com/open-telemetry/opentelemetry-specification/pull/998/files#r517616726. But I am yet to find out if any language has this implemented correctly. If .NET needs to fix that issue, we'll likely need changes from .NET runtime itself.

@cijothomas
Copy link
Member

The issue with instrumentations not propagating - is tracked here : #1561 Its closely related issue.

@utpilla
Copy link
Contributor Author

utpilla commented Jan 22, 2021

Closing this PR as we need to decide on the best approach to ensure that there are no broken traces due to differential sampling of spans within a single trace.

@cijothomas cijothomas closed this Jan 25, 2021
@utpilla utpilla deleted the utpilla/AlwaysCreateSpan branch January 27, 2021 22:33
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.

Always create Activity irrespective of SamplingDecision.
3 participants