From 506cfcf0631d4cd7373a19e7ccbdf332c106f8d1 Mon Sep 17 00:00:00 2001 From: Nathan L Smith Date: Thu, 16 Sep 2021 08:19:50 -0500 Subject: [PATCH] Record transaction duration alerts in microseconds (#112366) --- .../alerts/register_transaction_duration_alert_type.test.ts | 2 +- .../lib/alerts/register_transaction_duration_alert_type.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.test.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.test.ts index ec0a986e2722..43abe89a4733 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.test.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.test.ts @@ -59,7 +59,7 @@ describe('registerTransactionDurationAlertType', () => { transactionType: 'request', serviceName: 'opbeans-java', environment: 'Not defined', - threshold: 3000, + threshold: 3000000, triggerValue: '5,500 ms', interval: `5m`, }); diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts index fedc185d84f9..a831f94cd6b6 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts @@ -201,11 +201,11 @@ export function registerTransactionDurationAlertType({ [TRANSACTION_TYPE]: alertParams.transactionType, [PROCESSOR_EVENT]: ProcessorEvent.transaction, [ALERT_EVALUATION_VALUE]: transactionDuration, - [ALERT_EVALUATION_THRESHOLD]: alertParams.threshold, + [ALERT_EVALUATION_THRESHOLD]: thresholdMicroseconds, [ALERT_REASON]: formatTransactionDurationReason({ measured: transactionDuration, serviceName: alertParams.serviceName, - threshold: alertParams.threshold, + threshold: thresholdMicroseconds, asDuration, }), }, @@ -214,7 +214,7 @@ export function registerTransactionDurationAlertType({ transactionType: alertParams.transactionType, serviceName: alertParams.serviceName, environment: getEnvironmentLabel(alertParams.environment), - threshold: alertParams.threshold, + threshold: thresholdMicroseconds, triggerValue: transactionDurationFormatted, interval: `${alertParams.windowSize}${alertParams.windowUnit}`, });