feat(telemetry): added telemetry events for creation of integration,project,machine identity and user invitation to org

This commit is contained in:
Akhil Mohan
2024-02-23 13:19:16 +05:30
parent a231813f01
commit 76daa20d69
8 changed files with 148 additions and 18 deletions
@@ -61,8 +61,15 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
}
};
const flushAll = async () => {
if (postHog) {
await postHog.shutdownAsync();
}
};
return {
sendLoopsEvent,
sendPostHogEvents
sendPostHogEvents,
flushAll
};
};
@@ -8,7 +8,11 @@ export enum PostHogEventTypes {
UserSignedUp = "User Signed Up",
SecretRotated = "secrets rotated",
SecretScannerFull = "historical cloud secret scan",
SecretScannerPush = "cloud secret scan"
SecretScannerPush = "cloud secret scan",
ProjectCreated = "project created",
IntegrationCreated = "integration created",
MachineIdentityCreated = "machine identity created",
UserOrgInvitation = "user org invitation"
}
export type TSecretModifiedEvent = {
@@ -53,9 +57,57 @@ export type TSecretScannerEvent = {
};
};
export type TProjectCreateEvent = {
event: PostHogEventTypes.ProjectCreated;
properties: {
name: string;
orgId: string;
};
};
export type TMachineIdentityCreatedEvent = {
event: PostHogEventTypes.MachineIdentityCreated;
properties: {
name: string;
orgId: string;
identityId: string;
};
};
export type TIntegrationCreatedEvent = {
event: PostHogEventTypes.IntegrationCreated;
properties: {
projectId: string;
integrationId: string;
integration: string; // TODO: fix type
environment: string;
secretPath: string;
url?: string;
app?: string;
appId?: string;
targetEnvironment?: string;
targetEnvironmentId?: string;
targetService?: string;
targetServiceId?: string;
path?: string;
region?: string;
};
};
export type TUserOrgInvitedEvent = {
event: PostHogEventTypes.UserOrgInvitation;
properties: {
inviteeEmail: string;
};
};
export type TPostHogEvent = { distinctId: string } & (
| TSecretModifiedEvent
| TAdminInitEvent
| TUserSignedUpEvent
| TSecretScannerEvent
| TUserOrgInvitedEvent
| TMachineIdentityCreatedEvent
| TIntegrationCreatedEvent
| TProjectCreateEvent
);