Skip to content

Patching http clients erase existing headers #56

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

Merged
merged 4 commits into from
Apr 9, 2020

Conversation

tianchu
Copy link
Collaborator

@tianchu tianchu commented Apr 9, 2020

What does this PR do?

ebeee64 introduced a bug into the http clients patching -- existing headers may potentially be erased when injecting Datadog trace context headers, and only Datadog trace context headers will be sent with the request.

This is because some clients store headers in a dict-like objects, such as requests.structures.CaseInsensitiveDict and botocore.awsrequest.HeadersDict. These objects won't pass the isinstance(..., dict) test.

Instead of testing isinstance(..., dict), we should test isinstance(..., MutableMapping).

Checklist

  • Member of the Datadog team has run integration tests and updated snapshots if necessary

@tianchu tianchu requested a review from a team as a code owner April 9, 2020 03:32
Copy link
Contributor

@DarcyRaynerDD DarcyRaynerDD left a comment

Choose a reason for hiding this comment

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

I can confirm that this fixes issues I was seeing with the forwarder. Still a bit confused by some of the changes with the integration tests.

@tianchu tianchu force-pushed the tian.chu/fix-httplib-patch branch from 06ee151 to 3002377 Compare April 9, 2020 19:31
@tianchu tianchu force-pushed the tian.chu/fix-httplib-patch branch from 3002377 to 1fac0fa Compare April 9, 2020 21:49
@tianchu tianchu merged commit f3660b7 into master Apr 9, 2020
@tianchu tianchu deleted the tian.chu/fix-httplib-patch branch April 9, 2020 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants