Report the environment type on a workflow run event (live or development)

This commit is contained in:
Matt Aitken
2023-02-10 14:18:42 +00:00
parent ad26302925
commit 5e99b28ea5
2 changed files with 7 additions and 0 deletions
@@ -151,12 +151,14 @@ class BehaviouralAnalytics {
organizationId,
workflowId,
workflowRun,
environmentType,
runCount,
}: {
userId: string;
organizationId: string;
workflowId: string;
workflowRun: WorkflowRun;
environmentType: string;
runCount: number;
}) => {
if (this.client === undefined) return;
@@ -167,6 +169,7 @@ class BehaviouralAnalytics {
id: workflowRun.id,
workflowId: workflowRun.workflowId,
environmentId: workflowRun.environmentId,
environmentType,
eventRuleId: workflowRun.eventRuleId,
eventId: workflowRun.eventId,
error: workflowRun.error,
@@ -13,6 +13,9 @@ export class WorkflowRunCreatedEvent {
const workflowRun = await this.#prismaClient.workflowRun.findUnique({
where: { id },
include: {
environment: {
select: { slug: true },
},
workflow: {
select: {
id: true,
@@ -62,6 +65,7 @@ export class WorkflowRunCreatedEvent {
userId: user.id,
organizationId: workflowRun.workflow.organization.id,
workflowId: workflowRun.workflow.id,
environmentType: workflowRun.environment.slug,
runCount,
});
});