-
Notifications
You must be signed in to change notification settings - Fork 375
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
[core] Propagate synthetics origin headers #699
Changes from 4 commits
2f581a5
6bec473
8515420
c7bad8d
7d36eea
eb4bb64
43c05fc
7c9bc0e
de88487
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ def self.inject!(context, env) | |
env[HTTP_HEADER_TRACE_ID] = context.trace_id.to_s | ||
env[HTTP_HEADER_PARENT_ID] = context.span_id.to_s | ||
env[HTTP_HEADER_SAMPLING_PRIORITY] = context.sampling_priority.to_s | ||
env[HTTP_HEADER_ORIGIN] = context.origin.to_s if context.origin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a big deal, but it's fine if you call I might suggest we do the same for sampling priority line above, just as a minor bit of housekeeping and consistency. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, using |
||
env.delete(HTTP_HEADER_SAMPLING_PRIORITY) unless context.sampling_priority | ||
end | ||
|
||
|
@@ -28,7 +29,8 @@ def self.extract(env) | |
return Datadog::Context.new unless headers.valid? | ||
Datadog::Context.new(trace_id: headers.trace_id, | ||
span_id: headers.parent_id, | ||
sampling_priority: headers.sampling_priority) | ||
sampling_priority: headers.sampling_priority, | ||
origin: headers.origin) | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -309,7 +309,8 @@ | |
{ | ||
'HTTP_X_DATADOG_TRACE_ID' => '1', | ||
'HTTP_X_DATADOG_PARENT_ID' => '2', | ||
'HTTP_X_DATADOG_SAMPLING_PRIORITY' => Datadog::Ext::Priority::USER_KEEP.to_s | ||
'HTTP_X_DATADOG_SAMPLING_PRIORITY' => Datadog::Ext::Priority::USER_KEEP.to_s, | ||
'HTTP_X_DATADOG_ORIGIN' => 'synthetics' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Side note (not an action item for this PR), but we should move these distributed tracing examples, where possible, into some kind of shared examples, so we don't have to re-implement the tests for each integration. |
||
} | ||
end | ||
|
||
|
@@ -319,6 +320,7 @@ | |
expect(span.trace_id).to eq(1) | ||
expect(span.parent_id).to eq(2) | ||
expect(span.get_metric(Datadog::Ext::DistributedTracing::SAMPLING_PRIORITY_KEY)).to eq(2.0) | ||
expect(span.get_tag(Datadog::Ext::DistributedTracing::ORIGIN_KEY)).to eq('synthetics') | ||
end | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
nil
an acceptable output here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I want
nil
instead of''
so I can tell whether we should set/propagate this header further.