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

Fix telemetry header #781

Merged
merged 1 commit into from
Oct 25, 2019
Merged

Fix telemetry header #781

merged 1 commit into from
Oct 25, 2019

Conversation

ob-stripe
Copy link
Contributor

r? @remi-stripe
cc @stripe/api-libraries

I just noticed a bug with the telemetry header: it's serialized as {"last_request_metrics":{"request_id":["req_123"],"request_duration_ms":234}}, i.e. request_id is an array instead of a string.

This is because the response headers returned by the requestor is a map of string to list of strings (because a header may be repeated and have multiple values).

In this case we're fairly confident that there will only be a single value for the Request-Id header, so we fix this by fetching the first value.

Copy link
Contributor

@remi-stripe remi-stripe left a comment

Choose a reason for hiding this comment

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

Approving but I don't understand why the test didn't change

@ob-stripe
Copy link
Contributor Author

Approving but I don't understand why the test didn't change

We're stubbing the request method in the test, and we were returning the incorrect type (i.e. a map of string->string instead of a a map of string->list of strings). This is now fixed.

@ob-stripe ob-stripe merged commit 55d7bc1 into master Oct 25, 2019
@ob-stripe ob-stripe deleted the ob-fix-telemetry branch October 25, 2019 18:43
@ob-stripe
Copy link
Contributor Author

Released as 7.7.1.

@ctrudeau-stripe ctrudeau-stripe mentioned this pull request Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants