chore(automate): mixpanel metrics by function id and type (#3960)
* chore(automate): mixpanel metrics for function id and type * chore(automate): catch test env
This commit is contained in:
@@ -16,7 +16,10 @@ import {
|
||||
} from '@/modules/automate/repositories/automations'
|
||||
import { isNonNullable, Scopes, throwUncoveredError } from '@speckle/shared'
|
||||
import { registerOrUpdateScopeFactory } from '@/modules/shared/repositories/scopes'
|
||||
import { triggerAutomationRun } from '@/modules/automate/clients/executionEngine'
|
||||
import {
|
||||
getFunction,
|
||||
triggerAutomationRun
|
||||
} from '@/modules/automate/clients/executionEngine'
|
||||
import logStreamRest from '@/modules/automate/rest/logStream'
|
||||
import {
|
||||
getEncryptionKeyPairFor,
|
||||
@@ -25,7 +28,7 @@ import {
|
||||
import { buildDecryptor } from '@/modules/shared/utils/libsodium'
|
||||
import { getUserEmailFromAutomationRunFactory } from '@/modules/automate/services/tracking'
|
||||
import authGithubAppRest from '@/modules/automate/rest/authGithubApp'
|
||||
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
|
||||
import { getFeatureFlags, isTestEnv } from '@/modules/shared/helpers/envHelper'
|
||||
import { TokenScopeData } from '@/modules/shared/domain/rolesAndScopes/types'
|
||||
import { db } from '@/db/knex'
|
||||
import { ProjectSubscriptions, publish } from '@/modules/shared/utils/subscriptions'
|
||||
@@ -285,6 +288,10 @@ const initializeEventListeners = () => {
|
||||
return
|
||||
}
|
||||
|
||||
const fn = isTestEnv()
|
||||
? null
|
||||
: await getFunction({ functionId: functionRun.functionId })
|
||||
|
||||
const userEmail = await getUserEmailFromAutomationRunFactory({
|
||||
getFullAutomationRevisionMetadata: getFullAutomationRevisionMetadataFactory({
|
||||
db: projectDb
|
||||
@@ -300,6 +307,9 @@ const initializeEventListeners = () => {
|
||||
automationRevisionId: automationWithRevision.id,
|
||||
automationName: automationWithRevision.name,
|
||||
runId: run.id,
|
||||
functionId: fn?.functionId,
|
||||
functionName: fn?.functionName,
|
||||
functionType: fn?.isFeatured ? 'public' : 'private',
|
||||
functionRunId: functionRun.id,
|
||||
status: functionRun.status,
|
||||
durationInSeconds: functionRun.elapsed / 1000,
|
||||
|
||||
Reference in New Issue
Block a user