-
Notifications
You must be signed in to change notification settings - Fork 362
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 Stripe client telemetry to request headers #661
Conversation
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.
Lookin good! made some comments
Updated! |
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.
Looks largely good!
My one major objection is that I'd prefer not to pull in a new dependency and establish a new testing convention for this. All the tests around threading are nice, but I'm personally pretty comfortable assuming that ConcurrentLinkedQueue
's implementation is correct and isn't going to cause any problems around thread safety.
I'd prefer to just augment verifyRequest
to be able to deal with headers, and then just check that we got the telemetry one. If we were going to move everything over to the new testing system, then that would be a totally different story.
Do you have an opinion on this @ob-stripe?
I'd assume the same thing, but I think the purpose of the test is to make sure our logic is thread safe, not
Makes sense, let me see what I can do! |
Ah, right. I just meant that our logic is a pretty thin shim around the queue — |
@brandur-stripe re:
I poked around to try to see how I could write the tests using our existing tools, and I ran into the following problem:
Maybe it's a result of how I modified the |
Yeah, that's the same conclusion I reached back when I wrote I think |
Okay, thanks for looking into it at least! I don't feel too strongly about the new dependency, but if we decide to include it, it'd be nice to have some sort of idea of what our end game is so that we don't end up with half the tests running on one system and half running on the other a year for now. Stated differently: is But anyway, if OB's happy with it, then LGTM too. |
Thanks @brandur-stripe. I'll leave it to you and @ob-stripe to merge this when you're ready. |
Ack. @ob-stripe Mind taking a quick look before we merge? |
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.
LGTM!
Released as 7.19.0. |
Adds opt-in client telemetry similar to stripe/stripe-node#557, stripe/stripe-go#766, stripe/stripe-ruby#696, etc.
Request metrics are recorded in
LiveStripeResponseGetter
and stored on a thread safe buffer usingConcurrentLinkedQueue
. If the buffer exceeds 100 elements, metrics are dropped. When a request is sent, if the buffer is not empty, one of the metrics is popped off and sent as JSON in theX-Stripe-Client-Telemetry
header.Clients can enable the telemetry using:
r? @brandur-stripe
cc @dcarney-stripe @akropp-stripe