-
Notifications
You must be signed in to change notification settings - Fork 471
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
Track usage of raw_request
#1779
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Should we target master first and then merge the infrastructure change into beta? |
Yes. That's available now in #1780. |
pakrym-stripe
approved these changes
Dec 11, 2023
Usage telemetry infrastructure
863eac6
to
086f66c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
usage
toX-Stripe-Client-Telemetry
, without breaking changes to the public interface.raw_request
in the beta branch.Details
Release
The first commit Usage infrastructure I intend to merge into master in a follow-up, after discussion.
The second commit Usage for raw_reuest is only applicable to the beta branch. I've opened the PR against beta showing both for a more holistic review.
Implementation
The tricky part about all this is: we have a struct
BackendImplementation
with publicDo
andCall
methods (Call
invokesDo
). Only theDo
method has access toParams
which is where we want to putusage
, but only theCall
method has access toduration
, which also needs to go on the telemetry header. The ideal solution would involve changing the signature ofDo
so that it can shuffle the information back toCall
in the return value, but that's breaking. To avoid a breaking change, what we instead have to do is pass this information through theLastResponseSetter
.BackendImplementation
although "public" is marked as internal and we say that public use is deprecated since 2018. Things would be much simpler if we broke it.It also turns out, there's not much code sharing in the RawRequest implementation right now, it doesn't go through
backend.Call
, for instance.