Report usage of .save and StripeClient #1612
Merged
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.
Changelog
.save
and ofStripeClient
inX-Stripe-Client-Telemetry
. (You can disable telemetry via\Stripe\Stripe::setEnableTelemetry(false);
, see the README.)Details
I've added
usage
to several infrastructure methods:lib/ApiOperations/Request.php
. (Since they are underscored, they should not be considered part of the public interface). I've included a default value there for expedience sake, though. Most callsites for these methods have no usage to report.request
andrequestStream
inApiRequestor
. These are public, but I have added a default value so that it is non-breaking._requestRaw
and_requestRawStreaming
inApiRequestor
. No default value here, but they are private.RequestTelemetry
constructor which is public (but I doubt it has much external use), but I've added a default value there.BaseStripeClient
to always pass in through["stripe_client"]
as usage toApiRequestor
, and modified->save
inApiOperations
to pass in["save"]
through to the helpers inRequest.php
.Testing
I modified the existing test case for telemetry to use a method that would trigger "save" usage to be included. It mocks at the HTTP Client level, which is fine, because all the logic for telemetry is thankfully implemented at a higher level of abstraction in
ApiRequestor
.