From 5f43b49df31f1318f4bcee7dc1beb31b80db190e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Marcondes?= <55978943+cauemarcondes@users.noreply.github.com> Date: Wed, 8 Feb 2023 11:26:10 -0500 Subject: [PATCH] [APM]Latency threshold rule's threshold context variable should use milliseconds instead of microseconds (#150234) closes https://github.com/elastic/kibana/issues/125323 I couldn't test it yet, since alerts are firing with any context variable. I'll hold on to merge this until I can fully test it. --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../register_transaction_duration_rule_type.test.ts | 2 +- .../register_transaction_duration_rule_type.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/apm/server/routes/alerts/rule_types/transaction_duration/register_transaction_duration_rule_type.test.ts b/x-pack/plugins/apm/server/routes/alerts/rule_types/transaction_duration/register_transaction_duration_rule_type.test.ts index 1066eb8a987d8..cebf71f1bad97 100644 --- a/x-pack/plugins/apm/server/routes/alerts/rule_types/transaction_duration/register_transaction_duration_rule_type.test.ts +++ b/x-pack/plugins/apm/server/routes/alerts/rule_types/transaction_duration/register_transaction_duration_rule_type.test.ts @@ -65,7 +65,7 @@ describe('registerTransactionDurationRuleType', () => { 'Avg. latency is 5,500 ms in the last 5 mins for opbeans-java. Alert when > 3,000 ms.', transactionType: 'request', serviceName: 'opbeans-java', - threshold: 3000000, + threshold: 3000, triggerValue: '5,500 ms', viewInAppUrl: 'http://localhost:5601/eyr/app/apm/services/opbeans-java?transactionType=request&environment=ENVIRONMENT_ALL', diff --git a/x-pack/plugins/apm/server/routes/alerts/rule_types/transaction_duration/register_transaction_duration_rule_type.ts b/x-pack/plugins/apm/server/routes/alerts/rule_types/transaction_duration/register_transaction_duration_rule_type.ts index 75e1aef357088..803945568494b 100644 --- a/x-pack/plugins/apm/server/routes/alerts/rule_types/transaction_duration/register_transaction_duration_rule_type.ts +++ b/x-pack/plugins/apm/server/routes/alerts/rule_types/transaction_duration/register_transaction_duration_rule_type.ts @@ -281,7 +281,7 @@ export function registerTransactionDurationRuleType({ [TRANSACTION_TYPE]: transactionType, [PROCESSOR_EVENT]: ProcessorEvent.transaction, [ALERT_EVALUATION_VALUE]: transactionDuration, - [ALERT_EVALUATION_THRESHOLD]: thresholdMicroseconds, + [ALERT_EVALUATION_THRESHOLD]: ruleParams.threshold, [ALERT_REASON]: reason, ...sourceFields, }, @@ -292,7 +292,7 @@ export function registerTransactionDurationRuleType({ interval: `${ruleParams.windowSize}${ruleParams.windowUnit}`, reason, serviceName, - threshold: thresholdMicroseconds, + threshold: ruleParams.threshold, transactionType, triggerValue: transactionDurationFormatted, viewInAppUrl,