diff --git a/plugin-server/src/utils/db/postgres.ts b/plugin-server/src/utils/db/postgres.ts index caf7d13dd201a..7e859a3bc225e 100644 --- a/plugin-server/src/utils/db/postgres.ts +++ b/plugin-server/src/utils/db/postgres.ts @@ -105,7 +105,7 @@ export class PostgresRouter { transaction: (client: TransactionClient) => Promise ): Promise { const wrappedTag = `${PostgresUse[usage]}:Tx<${tag}>` - return instrumentQuery(this.statsd, 'query.postgres_transation', wrappedTag, async () => { + return instrumentQuery(this.statsd, 'query.postgres_transaction', wrappedTag, async () => { const timeout = timeoutGuard(`Postgres slow transaction warning after 30 sec!`) const client = await this.pools.get(usage)!.connect() try { diff --git a/plugin-server/src/worker/plugins/run.ts b/plugin-server/src/worker/plugins/run.ts index b9f4e45a26af0..d07e33dc67bd9 100644 --- a/plugin-server/src/worker/plugins/run.ts +++ b/plugin-server/src/worker/plugins/run.ts @@ -36,7 +36,7 @@ async function runSingleTeamPluginOnEvent( try { await onEvent!(event) pluginActionMsSummary - .labels(pluginConfig.id.toString(), 'onEvent', 'success') + .labels(pluginConfig.plugin?.id.toString() ?? '?', 'onEvent', 'success') .observe(new Date().getTime() - timer.getTime()) await hub.appMetrics.queueMetric({ teamId: event.team_id, @@ -47,7 +47,7 @@ async function runSingleTeamPluginOnEvent( } catch (error) { hub.statsd?.increment(`${metricName}.ERROR`, metricTags) pluginActionMsSummary - .labels(pluginConfig.id.toString(), 'onEvent', 'error') + .labels(pluginConfig.plugin?.id.toString() ?? '?', 'onEvent', 'error') .observe(new Date().getTime() - timer.getTime()) await processError(hub, pluginConfig, error, event) await hub.appMetrics.queueError( @@ -130,7 +130,7 @@ async function runSingleTeamPluginComposeWebhook( }) if (request.ok) { pluginActionMsSummary - .labels(pluginConfig.id.toString(), 'composeWebhook', 'success') + .labels(pluginConfig.plugin?.id.toString() ?? '?', 'composeWebhook', 'success') .observe(new Date().getTime() - timer.getTime()) await hub.appMetrics.queueMetric({ teamId: event.team_id, @@ -141,7 +141,7 @@ async function runSingleTeamPluginComposeWebhook( } else { hub.statsd?.increment(`${metricName}.ERROR`, metricTags) pluginActionMsSummary - .labels(pluginConfig.id.toString(), 'composeWebhook', 'error') + .labels(pluginConfig.plugin?.id.toString() ?? '?', 'composeWebhook', 'error') .observe(new Date().getTime() - timer.getTime()) const error = `Fetch to ${webhook.url} failed with ${request.statusText}` await processError(hub, pluginConfig, error, event) @@ -161,7 +161,7 @@ async function runSingleTeamPluginComposeWebhook( } catch (error) { hub.statsd?.increment(`${metricName}.ERROR`, metricTags) pluginActionMsSummary - .labels(pluginConfig.id.toString(), 'composeWebhook', 'error') + .labels(pluginConfig.plugin?.id.toString() ?? '?', 'composeWebhook', 'error') .observe(new Date().getTime() - timer.getTime()) await processError(hub, pluginConfig, error, event) await hub.appMetrics.queueError( @@ -239,7 +239,7 @@ export async function runProcessEvent(hub: Hub, event: PluginEvent): Promise