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

feat: add analytics event to track usage of provider webhooks #2832

Merged
merged 1 commit into from
Feb 19, 2023

Conversation

davidsoderberg
Copy link
Contributor

What change does this PR introduce?

Two tracking events so we can track how much provider webhooks is used.

Why was this change needed?

To be able to understand usage of our provider webhook feature

{
provide: AnalyticsService,
useFactory: async () => {
const analyticsService = new AnalyticsService(process.env.SEGMENT_TOKEN);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs to be added in terraform I guess? @scopsy

@@ -34,6 +36,17 @@ export class Webhook {
channel,
});

const member = await this.memberRepository.getOrganizationAdminAccount(command.organizationId);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do not know who created the Webhook so I am using admin account here...

@davidsoderberg davidsoderberg changed the title feat: add anlytics event to track usage of provider webhooks feat: add analytics event to track usage of provider webhooks Feb 19, 2023
Copy link
Contributor

@scopsy scopsy left a comment

Choose a reason for hiding this comment

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

Looks great! I will add the terraform entry aswell

Comment on lines +62 to +70
if (member) {
this.analyticsService.track('[Webhook] - Provider Webhook events parsed', member._userId, {
_organization: command.organizationId,
_environmentId: command.environmentId,
providerId,
channel,
events,
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think actually that this one will be enough (no need to have the top one. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added both to be able to track if we get more webhooks the we parse...

@davidsoderberg davidsoderberg added this pull request to the merge queue Feb 19, 2023
Merged via the queue into next with commit 52745b4 Feb 19, 2023
@davidsoderberg davidsoderberg deleted the webhook-analytics-tracking branch February 19, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants