-
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
Add request and response header tags to Rack #389
Add request and response header tags to Rack #389
Conversation
0aec286
to
4ccdcdb
Compare
4ccdcdb
to
1047403
Compare
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.
I'd say to refactor the integration a bit so that it's generic and configurable for collecting headers.
lib/ddtrace/ext/http.rb
Outdated
|
||
# Constants for request headers | ||
module RequestHeaders | ||
CACHE_CONTROL = 'http.request.headers.cache_control'.freeze |
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.
As we discussed, probably it's better to make it configurable as an option (easy accessible from rack
and rails
and sinatra
) so that users can define the list of headers they want to collect (even custom ones).
Then we have to pick the right defaults, so I'd advocate to collect what we're collecting right now (e.g. request_id
) and then double check with our security team for the rest.
The Agent, still has the capability to redact / obfuscate automatically collected headers and is configurable as defined in DataDog/datadog-trace-agent#398.
Sounds good @delner ?
…sponse.headers`.
4a7c12c
to
e711573
Compare
{}.tap do |result| | ||
env.each do |name, value| | ||
# Normalize the value, check if it's permitted. | ||
tag = Datadog::Ext::HTTP::Headers.to_tag(name.to_s.sub('HTTP_', '')) |
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.
let's do it the other way around; iterate over the whitelist instead (that is smaller) instead of the headers list that is in the order of thousands of elements
e711573
to
12da569
Compare
3f18f73
to
a8a6f8a
Compare
@palazzem Should we have separate lists for request and response headers? e.g. |
@delner I think so, probably it's way better so we differentiate a possible "clash" between request and response |
This pull requests allows users to define which HTTP headers appear as tags on their
rack.request
span.To do so, add the following option to your configuration:
Will result in the following tags:
http.request.headers.accept_encoding
http.response.headers.content_encoding
By default,
:headers
is set to{ response: ['Content-Type', 'X-Request-ID'] }
.This pull request also removes
http.request_id
in favor ofhttp.request.headers.x_request_id
andhttp.response.headers.x_request_id
.