refactor(editor): Add telemetry for workflow history (no-changelog) (#8072)

https://linear.app/n8n/issue/PAY-1142
This commit is contained in:
Iván Ovejero 2023-12-18 16:10:45 +01:00 committed by GitHub
parent 73d400a1bf
commit 62ce962ec9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -18,6 +18,7 @@ import { useWorkflowHistoryStore } from '@/stores/workflowHistory.store';
import { useUIStore } from '@/stores/ui.store';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { telemetry } from '@/plugins/telemetry';
import { useRootStore } from '@/stores/n8nRoot.store';
type WorkflowHistoryActionRecord = {
[K in Uppercase<WorkflowHistoryActionTypes[number]>]: Lowercase<K>;
@ -76,6 +77,7 @@ const evaluatedPruneTime = computed(() => Math.floor(workflowHistoryStore.evalua
const sendTelemetry = (event: string) => {
telemetry.track(event, {
instance_id: useRootStore().instanceId,
workflow_id: route.params.workflowId,
});
};

View file

@ -107,6 +107,7 @@ describe('WorkflowHistory', () => {
params: { workflowId, versionId: versionData.versionId },
});
expect(telemetry.track).toHaveBeenCalledWith('User opened workflow history', {
instance_id: '',
workflow_id: workflowId,
});
});
@ -124,6 +125,7 @@ describe('WorkflowHistory', () => {
await waitFor(() => {
expect(router.replace).not.toHaveBeenCalled();
expect(telemetry.track).toHaveBeenCalledWith('User selected version', {
instance_id: '',
workflow_id: workflowId,
});
});
@ -142,6 +144,7 @@ describe('WorkflowHistory', () => {
params: { workflowId, versionId },
});
expect(telemetry.track).toHaveBeenCalledWith('User selected version', {
instance_id: '',
workflow_id: workflowId,
});
});
@ -159,6 +162,7 @@ describe('WorkflowHistory', () => {
params: { workflowId, versionId },
});
expect(telemetry.track).toHaveBeenCalledWith('User opened version in new tab', {
instance_id: '',
workflow_id: workflowId,
});
});
@ -180,6 +184,7 @@ describe('WorkflowHistory', () => {
params: { workflowId, versionId },
});
expect(telemetry.track).toHaveBeenCalledWith('User opened version in new tab', {
instance_id: '',
workflow_id: workflowId,
});
});
@ -202,6 +207,7 @@ describe('WorkflowHistory', () => {
params: { name: newWorkflowId },
});
expect(telemetry.track).toHaveBeenCalledWith('User cloned version', {
instance_id: '',
workflow_id: workflowId,
});
});
@ -217,6 +223,7 @@ describe('WorkflowHistory', () => {
await waitFor(() => {
expect(telemetry.track).toHaveBeenCalledWith('User downloaded version', {
instance_id: '',
workflow_id: workflowId,
});
});