feat: Track node errors on PostHog (#8774)

Co-authored-by: Marcus <marcus@n8n.io>
This commit is contained in:
Michael Kret 2024-03-05 16:58:14 +02:00 committed by GitHub
parent c7c17673cb
commit 35f6826150
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -598,6 +598,7 @@ import { useToast } from '@/composables/useToast';
import { isEqual, isObject } from 'lodash-es';
import { useExternalHooks } from '@/composables/useExternalHooks';
import { useSourceControlStore } from '@/stores/sourceControl.store';
import { useRootStore } from '@/stores/n8nRoot.store';
import RunDataPinButton from '@/components/RunDataPinButton.vue';
const RunDataTable = defineAsyncComponent(
@ -738,12 +739,38 @@ export default defineComponent({
this.setDisplayMode();
this.activatePane();
}
if (this.hasRunError) {
const error = this.workflowRunData?.[this.node.name]?.[this.runIndex]?.error;
const errorsToTrack = ['unknown error'];
if (error && errorsToTrack.some((e) => error.message.toLowerCase().includes(e))) {
this.$telemetry.track(
`User encountered an error: "${error.message}"`,
{
node: this.node.type,
errorMessage: error.message,
nodeVersion: this.node.typeVersion,
n8nVersion: this.rootStore.versionCli,
},
{
withPostHog: true,
},
);
}
}
},
beforeUnmount() {
this.hidePinDataDiscoveryTooltip();
},
computed: {
...mapStores(useNodeTypesStore, useNDVStore, useWorkflowsStore, useSourceControlStore),
...mapStores(
useNodeTypesStore,
useNDVStore,
useWorkflowsStore,
useSourceControlStore,
useRootStore,
),
isReadOnlyRoute() {
return this.$route?.meta?.readOnlyCanvas === true;
},