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

Remove SpanID from sampling parameters #1286

Merged

Conversation

pjanotti
Copy link
Contributor

Update code per latest spec, see:
open-telemetry/opentelemetry-specification#621

The goal is to avoid any SDK implementation from taking a dependency on it.

@codecov
Copy link

codecov bot commented May 28, 2020

Codecov Report

Merging #1286 into master will increase coverage by 0.10%.
The diff coverage is 71.79%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1286      +/-   ##
============================================
+ Coverage     86.21%   86.31%   +0.10%     
- Complexity     1212     1214       +2     
============================================
  Files           154      153       -1     
  Lines          4518     4546      +28     
  Branches        405      411       +6     
============================================
+ Hits           3895     3924      +29     
+ Misses          478      471       -7     
- Partials        145      151       +6     
Impacted Files Coverage Δ Complexity Δ
...main/java/io/opentelemetry/sdk/trace/Samplers.java 93.87% <ø> (ø) 8.00 <0.00> (ø)
...ava/io/opentelemetry/sdk/trace/SpanBuilderSdk.java 95.68% <ø> (ø) 43.00 <0.00> (ø)
...trib/trace/jaeger/sampler/JaegerRemoteSampler.java 72.54% <0.00%> (ø) 9.00 <0.00> (ø)
...trib/trace/jaeger/sampler/PerOperationSampler.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...trib/trace/jaeger/sampler/RateLimitingSampler.java 63.63% <50.00%> (ø) 6.00 <0.00> (ø)
...trib/trace/export/DisruptorAsyncSpanProcessor.java 86.00% <57.14%> (+5.44%) 10.00 <0.00> (ø)
...telemetry/exporters/zipkin/ZipkinSpanExporter.java 85.24% <90.00%> (+0.63%) 35.00 <1.00> (ø)
...opentelemetry/sdk/common/export/ConfigBuilder.java 70.83% <100.00%> (+9.96%) 7.00 <1.00> (+3.00)
.../sdk/contrib/trace/jaeger/sampler/RateLimiter.java 100.00% <0.00%> (+5.88%) 5.00% <0.00%> (+1.00%)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b30790c...ffdc6f0. Read the comment docs.

spanKind,
immutableAttributes,
immutableLinks);
parentContext, traceId, spanName, spanKind, immutableAttributes, immutableLinks);
Copy link
Contributor

Choose a reason for hiding this comment

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

One of the goals of this change in the spec was to enable deferring the generation of a span id when one wasn't needed. Is it possible to defer the spanId creation, and if not, why not?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jkwatson To be clear, you are talking about SpanId being crated unconditionally before this line? e.g.

SpanId spanId = idsGenerator.generateSpanId();

?

Copy link
Member

Choose a reason for hiding this comment

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

@carlosalberto Exactly, this was mentioned on the original spec PR (open-telemetry/opentelemetry-specification#621) to improve performance.

Copy link
Member

Choose a reason for hiding this comment

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

Follow-up idea (for spec): why not also generate trace ID later? And provide an option for samplers that need it (only one single one: ProbabilitySampler) to optionally generate a trace ID themselves that the SDK will use.

Copy link
Member

Choose a reason for hiding this comment

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

Please move this conversation to an issue. I think it is important to fix API first then we can address the optimizations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was focusing on avoiding samplers starting to use the SpanId and missed the optimization. Let me see what can be done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the code to use SpanId.getInvalid() if the span is not sampled and only generate a new SpanId if it is sampled.

Copy link
Member

Choose a reason for hiding this comment

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

Please revert the last commit, and don't do the optimization now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, reverted the optimization - didn't see your comment on GH prior to the change...

@thisthat thisthat linked an issue May 29, 2020 that may be closed by this pull request
@carlosalberto
Copy link
Contributor

Thanks for the PR! My only concern is that @jkwatson mention of us still needing to create a SpanId for non-sampled values.

Copy link
Member

@arminru arminru left a comment

Choose a reason for hiding this comment

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

This PR looks fine, we can take care of the deferring the ID generation in a follow-up.

spanKind,
immutableAttributes,
immutableLinks);
parentContext, traceId, spanName, spanKind, immutableAttributes, immutableLinks);
Copy link
Member

Choose a reason for hiding this comment

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

Please revert the last commit, and don't do the optimization now.

@bogdandrutu bogdandrutu merged commit 7fb0d4d into open-telemetry:master May 29, 2020
@pjanotti pjanotti deleted the remove-spanId-from-sampling-params branch May 29, 2020 16:02
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.

Remove SpanId from Sampler input
6 participants