feat: Implement telemetry for step creation and updates

This commit is contained in:
Faruk AYDIN
2022-05-02 00:59:56 +02:00
parent 5c1e0f5b17
commit 4ff6d887ab
2 changed files with 36 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ import Analytics, { apiObject } from '@rudderstack/rudder-sdk-node';
import organizationId from './organization-id';
import instanceId from './instance-id';
import appConfig from '../../config/app';
import Step from '../../models/step';
const WRITE_KEY = '284Py4VgK2MsNYV7xlKzyrALx0v';
const DATA_PLANE_URL = 'https://telemetry.automatisch.io/v1/batch';
@@ -31,11 +32,28 @@ class Telemetry {
});
}
// Example implementation of telemetry methods.
// TODO: Revise properties for the step.
// stepUpdated(key: string, appKey: string) {
// this.track('Step updated', { key, appKey });
// }
stepCreated(step: Step) {
this.track('stepCreated', {
stepId: step.id,
flowId: step.flowId,
createdAt: step.createdAt,
updatedAt: step.updatedAt,
});
}
stepUpdated(step: Step) {
this.track('stepUpdated', {
stepId: step.id,
flowId: step.flowId,
key: step.key,
appKey: step.appKey,
type: step.type,
position: step.position,
status: step.status,
createdAt: step.createdAt,
updatedAt: step.updatedAt,
});
}
}
const telemetry = new Telemetry();