feat(analytics): track stripe subscription events#2012
Conversation
…analytics-client-and-stripe-payment-tracking
rust/cloud-storage/authentication_service/src/api/user/stripe.rs
Outdated
Show resolved
Hide resolved
| .search_event_queue(&config.search_event_queue); | ||
| tracing::trace!("initialized sqs client"); | ||
|
|
||
| // Initialize analytics client with configured providers |
There was a problem hiding this comment.
you need to update the infra/stacks/authentication_service with the values for these new environment variables you are adding
to do so safely, you should store them in secretsmanager and you can grab them and inject them into the env of the container
There was a problem hiding this comment.
I updated infra/stacks/authentication_service but I was curious if it was possible to make the env vars optional? I tried to use config.get instead of config.require which seems fine but I'm unsure of how to properly use it in the containerEnvVars object.
| return; | ||
| }; | ||
|
|
||
| tokio::spawn(async move { |
There was a problem hiding this comment.
we should probably instrument tracing here so we can have email, subscription id and other values we care about in the logs
There was a problem hiding this comment.
Added but I'm not sure if it's the correct approach
There was a problem hiding this comment.
When you run something inside of a tokio spawn you lose all the context of the parent trace, this will allow us to not lose that context which I think is good
rust/cloud-storage/authentication_service/src/api/webhooks/user/stripe_webhook.rs
Outdated
Show resolved
Hide resolved
whutchinson98
left a comment
There was a problem hiding this comment.
Please also add tracing::instrument so we can get otel support for the methods
|
|
||
| const MACRO_API_TOKENS = getMacroApiToken(); | ||
|
|
||
| const GA_ANALYTICS_MEASUREMENT_ID = config.require('ga_measurement_id'); |
There was a problem hiding this comment.
You need to update Pulumi.dev.yaml and Pulumi.prod.yaml with this key and the correct value which is the name of the secret
|
|
||
| const GA_ANALYTICS_MEASUREMENT_ID = config.require('ga_measurement_id'); | ||
|
|
||
| const GA_ANALYTICS_API_SECRET = config.require('ga_api_secret'); |
There was a problem hiding this comment.
You need to update Pulumi.dev.yaml and Pulumi.prod.yaml with this key and the correct value which is the name of the secret
| const gaAnalyticsApiSecretKeyArn: pulumi.Output<string> = aws.secretsmanager | ||
| .getSecretVersionOutput({ secretId: GA_ANALYTICS_API_SECRET }) | ||
| .apply((secret) => secret.arn); | ||
|
|
||
| const META_PIXEL_ID = config.require('meta_pixel_id'); | ||
|
|
||
| const META_PIXEL_ACCESS_TOKEN = config.require('meta_access_token'); | ||
| const metaPixelAccessTokenArn: pulumi.Output<string> = aws.secretsmanager | ||
| .getSecretVersionOutput({ secretId: META_PIXEL_ACCESS_TOKEN }) | ||
| .apply((secret) => secret.arn); |
There was a problem hiding this comment.
The way you are getting and storing these secrets is that they will be the secret names, your code in authentication_service expects them to be the real value.
If you'd like we can do a call and I can walk you through this stuff
| .getSecretVersionOutput({ secretId: GA_ANALYTICS_API_SECRET }) | ||
| .apply((secret) => secret.arn); | ||
|
|
||
| const META_PIXEL_ID = config.require('meta_pixel_id'); |
There was a problem hiding this comment.
You need to update Pulumi.dev.yaml and Pulumi.prod.yaml with this key and the correct value which is the name of the secret
No description provided.