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

B3 Header Support #753

Merged
merged 24 commits into from
May 17, 2019
Merged

B3 Header Support #753

merged 24 commits into from
May 17, 2019

Conversation

brettlangdon
Copy link
Member

This PR adds support for parsing B3 headers for distributed tracing, including B3 single header.

We add two new configuration options: propagation_extract_style and propagation_inject_style which define which header formats we will try to parse and which we will inject into headers.

By default we will attempt to parse every supported type of header. However, we only accept the propagated context if the values being propagated match, for example if we parse a different trace id from Datadog headers vs B3 headers then we do not use the context created.

By default we will only inject Datadog headers.

@brettlangdon brettlangdon added core Involves Datadog core libraries do-not-merge/WIP Not ready for merge feature Involves a product feature labels May 9, 2019
Copy link
Contributor

@delner delner left a comment

Choose a reason for hiding this comment

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

Great start overall. I think we might want to shuffle around some things while we have an opportunity to.

I'd also like to suggest that we consider making propagation styles a bit more modular, so that users with a need to define custom propagation have an API to do so. Even if this is might be a bit out of scope, then API changes we're putting in place here should at least be congruent with a plugin-friendly API, so we don't introduce breaking changes if we want to do so later.

I skipped on reviewing the tests until other changes are resolved.

lib/ddtrace/configuration/settings.rb Show resolved Hide resolved
lib/ddtrace/configuration/settings.rb Show resolved Hide resolved
lib/ddtrace/propagation/distributed_headers/b3.rb Outdated Show resolved Hide resolved
lib/ddtrace/propagation/distributed_headers/b3.rb Outdated Show resolved Hide resolved
lib/ddtrace/propagation/distributed_headers/base.rb Outdated Show resolved Hide resolved
lib/ddtrace/propagation/distributed_headers/b3.rb Outdated Show resolved Hide resolved
lib/ddtrace/propagation/http_propagator.rb Outdated Show resolved Hide resolved
lib/ddtrace/propagation/http_propagator.rb Outdated Show resolved Hide resolved
@brettlangdon brettlangdon removed the do-not-merge/WIP Not ready for merge label May 15, 2019
# Truncate to trailing 16 characters if length is greater than 16
# https://github.com/apache/incubator-zipkin/blob/21fe362899fef5c593370466bc5707d3837070c2/zipkin/src/main/java/zipkin2/storage/StorageComponent.java#L49-L53
# DEV: This ensures we truncate B3 128-bit trace and span ids to 64-bit
value = value[value.length - 16, 16] if value.length > 16
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@brettlangdon brettlangdon merged commit b1eeb92 into 0.24-dev May 17, 2019
@brettlangdon brettlangdon added this to the 0.24.0 milestone May 17, 2019
@brettlangdon brettlangdon deleted the brettlangdon/b3 branch May 17, 2019 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries feature Involves a product feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants