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

Add W3C Trace Context propagator #2451

Merged
merged 3 commits into from
Dec 2, 2022
Merged

Add W3C Trace Context propagator #2451

merged 3 commits into from
Dec 2, 2022

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Nov 30, 2022

This PR adds support trace propagation through the the "W3C Trace Context": https://www.w3.org/TR/trace-context/.

This standard is used by OpenTelemetry to propagate traces by default.

This PR adds the propagator class but does not wire it yet, as to make this PR smaller to review.

@marcotc marcotc requested a review from a team November 30, 2022 19:39
@marcotc marcotc self-assigned this Nov 30, 2022
Comment on lines +88 to +97
# Check if the Priority Sampling decision is to keep or drop the trace.
# Other factors can influence the sampling decision; this method is only
# responsible for interpreting the Sampling Priority decision.
#
# @param priority_sampling [Integer] priority sampling number
# @return [Boolean] true if trace is "kept" by priority sampling
# @return [Boolean] false if trace is "dropped" by priority sampling
def self.sampled?(priority_sampling)
priority_sampling >= Ext::Priority::AUTO_KEEP
end
Copy link
Member Author

@marcotc marcotc Nov 30, 2022

Choose a reason for hiding this comment

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

I got tired of obscure sampling comparisons all over ddtrace, like sampling_priority > AUTO_KEEP or sampling_priority <= AUTO_KEEP. It's never clear what they mean.
I added this so we can start cleaning up such checks all over ddtrace now.

@codecov-commenter
Copy link

Codecov Report

Merging #2451 (565b05d) into master (970c87a) will increase coverage by 0.00%.
The diff coverage is 99.72%.

@@           Coverage Diff            @@
##           master    #2451    +/-   ##
========================================
  Coverage   98.34%   98.34%            
========================================
  Files        1101     1103     +2     
  Lines       58977    59338   +361     
========================================
+ Hits        58001    58357   +356     
- Misses        976      981     +5     
Impacted Files Coverage Δ
lib/datadog/tracing/distributed/trace_context.rb 99.32% <99.32%> (ø)
lib/datadog/tracing/sampling/priority_sampler.rb 94.91% <100.00%> (+0.17%) ⬆️
lib/datadog/tracing/trace_digest.rb 100.00% <100.00%> (ø)
.../datadog/tracing/distributed/trace_context_spec.rb 100.00% <100.00%> (ø)
.../datadog/tracing/sampling/priority_sampler_spec.rb 100.00% <100.00%> (ø)
spec/datadog/tracing/trace_digest_spec.rb 100.00% <100.00%> (ø)
spec/support/http_helpers.rb 90.90% <0.00%> (-9.10%) ⬇️
lib/datadog/core/diagnostics/environment_logger.rb 98.42% <0.00%> (-1.58%) ⬇️
spec/datadog/profiling/native_extension_spec.rb 96.80% <0.00%> (-1.07%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@marcotc marcotc merged commit 64d2f64 into master Dec 2, 2022
@marcotc marcotc deleted the w3c-trace-context branch December 2, 2022 22:06
@github-actions github-actions bot added this to the 1.8.0 milestone Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants