-
Notifications
You must be signed in to change notification settings - Fork 835
urllib3: add support for capturing client headers #4050
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
base: main
Are you sure you want to change the base?
Conversation
| will extract ``content-type`` and ``custom_request_header`` from the request headers and add them as span attributes. | ||
| Request header names in aiohttp are case-insensitive. So, giving the header name as ``CUStom-Header`` in the environment |
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.
| Request header names in aiohttp are case-insensitive. So, giving the header name as ``CUStom-Header`` in the environment | |
| Request header names in urllib3 are case-insensitive. So, giving the header name as ``CUStom-Header`` in the environment |
| will extract ``content-type`` and ``custom_response_header`` from the response headers and add them as span attributes. | ||
| Response header names in aiohttp are case-insensitive. So, giving the header name as ``CUStom-Header`` in the environment |
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.
| Response header names in aiohttp are case-insensitive. So, giving the header name as ``CUStom-Header`` in the environment | |
| Response header names in urllib3 are case-insensitive. So, giving the header name as ``CUStom-Header`` in the environment |
| response_headers_to_set = get_custom_header_attributes( | ||
| response.headers, | ||
| captured_response_headers, | ||
| sensitive_headers, | ||
| normalise_response_header_name, | ||
| ) | ||
| for header, value in response_headers_to_set.items(): | ||
| span.set_attribute(header, value) |
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.
nit: any reason not to just do this
| response_headers_to_set = get_custom_header_attributes( | |
| response.headers, | |
| captured_response_headers, | |
| sensitive_headers, | |
| normalise_response_header_name, | |
| ) | |
| for header, value in response_headers_to_set.items(): | |
| span.set_attribute(header, value) | |
| span.set_attributes(get_custom_header_attributes( | |
| response.headers, | |
| captured_response_headers, | |
| sensitive_headers, | |
| normalise_response_header_name, | |
| )) |
|
I did a little bit of digging into the urllib source and it looks like some headers are added within |
Description
This PR adds support to capture and sanitize custom client headers in the urllib3 instrumentation.
Refs #3962
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.