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

Add usage data for stripe client usage #1982

Merged
merged 4 commits into from
Feb 7, 2025

Conversation

mbroshi-stripe
Copy link
Contributor

@mbroshi-stripe mbroshi-stripe commented Feb 5, 2025

Why?

We would like to get a better sense of how many users are using Stripe Clients (aka. client.API) vs the global client. This will help us better inform how to update documentation and consider possible changes to the Stripe Client going forward.

What?

This sends the string stripe_client to telemetry statistics when they are enabled when a Stripe Client was used for that request. It does this by wrapping the existing Backends with a usageBackend that sets the string stripe_client on requests. This string is not sent on the global client, so we can distinguish the two.

I also updated a few random tests to use the Stripe Client to add some additional test coverage for this change.

Changelog

  • Add telemetry for usage of the Stripe Client

@mbroshi-stripe mbroshi-stripe marked this pull request as draft February 5, 2025 18:28
@mbroshi-stripe mbroshi-stripe force-pushed the mbroshi/add-client-usage branch from 3c4468f to 5658ce1 Compare February 5, 2025 20:08
@mbroshi-stripe mbroshi-stripe marked this pull request as ready for review February 5, 2025 20:08
Copy link
Contributor

@helenye-stripe helenye-stripe left a comment

Choose a reason for hiding this comment

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

just one small nit

client/api.go Outdated Show resolved Hide resolved
@mbroshi-stripe mbroshi-stripe merged commit 2917c4b into master Feb 7, 2025
12 checks passed
@mbroshi-stripe mbroshi-stripe deleted the mbroshi/add-client-usage branch February 7, 2025 21:28
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