feat(core): Add telemetry events for archive and unarchive (no-changelog) (#15224)

This commit is contained in:
Jaakko Husso
2025-05-08 16:55:22 +03:00
committed by GitHub
parent c1229e007e
commit cfea538f1c
2 changed files with 66 additions and 0 deletions

View File

@@ -700,6 +700,50 @@ describe('TelemetryEventRelay', () => {
});
});
it('should track on `workflow-archived` event', () => {
const event: RelayEventMap['workflow-archived'] = {
user: {
id: 'user123',
email: 'user@example.com',
firstName: 'John',
lastName: 'Doe',
role: 'global:owner',
},
workflowId: 'workflow123',
publicApi: false,
};
eventService.emit('workflow-archived', event);
expect(telemetry.track).toHaveBeenCalledWith('User archived workflow', {
user_id: 'user123',
workflow_id: 'workflow123',
public_api: false,
});
});
it('should track on `workflow-unarchived` event', () => {
const event: RelayEventMap['workflow-unarchived'] = {
user: {
id: 'user123',
email: 'user@example.com',
firstName: 'John',
lastName: 'Doe',
role: 'global:owner',
},
workflowId: 'workflow123',
publicApi: false,
};
eventService.emit('workflow-unarchived', event);
expect(telemetry.track).toHaveBeenCalledWith('User unarchived workflow', {
user_id: 'user123',
workflow_id: 'workflow123',
public_api: false,
});
});
it('should track on `workflow-deleted` event', () => {
const event: RelayEventMap['workflow-deleted'] = {
user: {

View File

@@ -77,6 +77,8 @@ export class TelemetryEventRelay extends EventRelay {
'ldap-login-sync-failed': (event) => this.ldapLoginSyncFailed(event),
'login-failed-due-to-ldap-disabled': (event) => this.loginFailedDueToLdapDisabled(event),
'workflow-created': (event) => this.workflowCreated(event),
'workflow-archived': (event) => this.workflowArchived(event),
'workflow-unarchived': (event) => this.workflowUnarchived(event),
'workflow-deleted': (event) => this.workflowDeleted(event),
'workflow-sharing-updated': (event) => this.workflowSharingUpdated(event),
'workflow-saved': async (event) => await this.workflowSaved(event),
@@ -532,6 +534,26 @@ export class TelemetryEventRelay extends EventRelay {
});
}
private workflowArchived({ user, workflowId, publicApi }: RelayEventMap['workflow-archived']) {
this.telemetry.track('User archived workflow', {
user_id: user.id,
workflow_id: workflowId,
public_api: publicApi,
});
}
private workflowUnarchived({
user,
workflowId,
publicApi,
}: RelayEventMap['workflow-unarchived']) {
this.telemetry.track('User unarchived workflow', {
user_id: user.id,
workflow_id: workflowId,
public_api: publicApi,
});
}
private workflowDeleted({ user, workflowId, publicApi }: RelayEventMap['workflow-deleted']) {
this.telemetry.track('User deleted workflow', {
user_id: user.id,