From ce7922be954d843cead3d9c41dfed2e1ba8f3e85 Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Mon, 21 Sep 2020 12:18:45 +0200 Subject: [PATCH] [APM] Use model_plot as a signal for anomaly scores (#77756) --- .../lib/service_map/get_service_anomalies.ts | 49 +- .../__snapshots__/service_maps.snap | 478 ++++++++++++++++++ .../trial/tests/service_maps/service_maps.ts | 38 +- .../trial/tests/services/top_services.ts | 10 +- 4 files changed, 547 insertions(+), 28 deletions(-) diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts index da087b4c1911..44c0c9614209 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts +++ b/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts @@ -60,11 +60,16 @@ export async function getServiceAnomalies({ query: { bool: { filter: [ - { term: { result_type: 'record' } }, + { terms: { result_type: ['model_plot', 'record'] } }, { terms: { job_id: mlJobIds } }, { range: { - timestamp: { gte: start, lte: end, format: 'epoch_millis' }, + timestamp: { + // fetch data for at least 30 minutes + gte: Math.min(end - 30 * 60 * 1000, start), + lte: end, + format: 'epoch_millis', + }, }, }, { @@ -83,7 +88,13 @@ export async function getServiceAnomalies({ top_score: { top_hits: { sort: { record_score: 'desc' }, - _source: { includes: ['actual', 'job_id', 'by_field_value'] }, + _source: [ + 'actual', + 'job_id', + 'by_field_value', + 'result_type', + 'record_score', + ], size: 1, }, }, @@ -113,10 +124,19 @@ interface ServiceAnomaliesAggResponse { hits: Array<{ sort: [number]; _source: { - actual: [number]; job_id: string; by_field_value: string; - }; + } & ( + | { + record_score: number | null; + result_type: 'record'; + actual: number[]; + } + | { + result_type: 'model_plot'; + actual?: number; + } + ); }>; }; }; @@ -127,12 +147,15 @@ interface ServiceAnomaliesAggResponse { function transformResponseToServiceAnomalies( response: ServiceAnomaliesAggResponse -): Record { +) { const serviceAnomaliesMap = ( response.aggregations?.services.buckets ?? [] - ).reduce( + ).reduce>( (statsByServiceName, { key: serviceName, top_score: topScoreAgg }) => { - const anomalyScore = topScoreAgg.hits.hits[0]?.sort?.[0]; + const mlResult = topScoreAgg.hits.hits[0]._source; + + const anomalyScore = + (mlResult.result_type === 'record' && mlResult.record_score) || 0; const severity = getSeverity(anomalyScore); const healthStatus = getServiceHealthStatus({ severity }); @@ -140,16 +163,20 @@ function transformResponseToServiceAnomalies( return { ...statsByServiceName, [serviceName]: { - transactionType: topScoreAgg.hits.hits[0]?._source?.by_field_value, + transactionType: mlResult.by_field_value, + jobId: mlResult.job_id, + actualValue: + mlResult.result_type === 'record' + ? mlResult.actual[0] + : mlResult.actual, anomalyScore, - actualValue: topScoreAgg.hits.hits[0]?._source?.actual?.[0], - jobId: topScoreAgg.hits.hits[0]?._source?.job_id, healthStatus, }, }; }, {} ); + return serviceAnomaliesMap; } diff --git a/x-pack/test/apm_api_integration/trial/tests/service_maps/__snapshots__/service_maps.snap b/x-pack/test/apm_api_integration/trial/tests/service_maps/__snapshots__/service_maps.snap index 199a49dce8f9..bf42c0843815 100644 --- a/x-pack/test/apm_api_integration/trial/tests/service_maps/__snapshots__/service_maps.snap +++ b/x-pack/test/apm_api_integration/trial/tests/service_maps/__snapshots__/service_maps.snap @@ -116,6 +116,13 @@ Array [ "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -143,6 +150,13 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -170,6 +184,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -182,6 +203,13 @@ Array [ "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": ">postgresql", "targetData": Object { @@ -203,6 +231,13 @@ Array [ "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-go", "targetData": Object { @@ -230,6 +265,13 @@ Array [ "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-python", "targetData": Object { @@ -237,6 +279,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -250,6 +299,13 @@ Array [ "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-ruby", "targetData": Object { @@ -276,6 +332,13 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": ">postgresql", "targetData": Object { @@ -297,6 +360,13 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-go", "targetData": Object { @@ -324,6 +394,13 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-python", "targetData": Object { @@ -331,6 +408,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -343,6 +427,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": ">elasticsearch", "targetData": Object { @@ -363,6 +454,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": ">postgresql", "targetData": Object { @@ -383,6 +481,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": ">redis", "targetData": Object { @@ -404,6 +509,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-go", "targetData": Object { @@ -431,6 +543,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-java", "targetData": Object { @@ -438,6 +557,13 @@ Array [ "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -451,6 +577,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-node", "targetData": Object { @@ -458,6 +591,13 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -545,6 +685,13 @@ Array [ "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -571,6 +718,13 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -597,6 +751,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -609,6 +770,12 @@ Array [ "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, "target": "opbeans-go", "targetData": Object { @@ -635,6 +802,12 @@ Array [ "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, "target": "opbeans-java", "targetData": Object { @@ -642,6 +815,13 @@ Array [ "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -654,6 +834,12 @@ Array [ "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, "target": "opbeans-node", "targetData": Object { @@ -661,6 +847,13 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -673,6 +866,12 @@ Array [ "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, "target": "opbeans-python", "targetData": Object { @@ -680,6 +879,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -692,6 +898,12 @@ Array [ "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, "target": "opbeans-ruby", "targetData": Object { @@ -715,6 +927,12 @@ Array [ "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, }, Object { @@ -723,6 +941,13 @@ Array [ "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, Object { @@ -731,6 +956,13 @@ Array [ "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, Object { @@ -739,6 +971,13 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, Object { @@ -863,6 +1102,13 @@ Object { "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -890,6 +1136,13 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -917,6 +1170,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -929,6 +1189,13 @@ Object { "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": ">postgresql", "targetData": Object { @@ -950,6 +1217,13 @@ Object { "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-go", "targetData": Object { @@ -977,6 +1251,13 @@ Object { "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-python", "targetData": Object { @@ -984,6 +1265,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -997,6 +1285,13 @@ Object { "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-ruby", "targetData": Object { @@ -1023,6 +1318,13 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": ">postgresql", "targetData": Object { @@ -1044,6 +1346,13 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-go", "targetData": Object { @@ -1071,6 +1380,13 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-python", "targetData": Object { @@ -1078,6 +1394,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -1090,6 +1413,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": ">elasticsearch", "targetData": Object { @@ -1110,6 +1440,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": ">postgresql", "targetData": Object { @@ -1130,6 +1467,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": ">redis", "targetData": Object { @@ -1151,6 +1495,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-go", "targetData": Object { @@ -1178,6 +1529,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-java", "targetData": Object { @@ -1185,6 +1543,13 @@ Object { "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -1198,6 +1563,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, "target": "opbeans-node", "targetData": Object { @@ -1205,6 +1577,13 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -1292,6 +1671,13 @@ Object { "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -1318,6 +1704,13 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -1344,6 +1737,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -1356,6 +1756,12 @@ Object { "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, "target": "opbeans-go", "targetData": Object { @@ -1382,6 +1788,12 @@ Object { "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, "target": "opbeans-java", "targetData": Object { @@ -1389,6 +1801,13 @@ Object { "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -1401,6 +1820,12 @@ Object { "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, "target": "opbeans-node", "targetData": Object { @@ -1408,6 +1833,13 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -1420,6 +1852,12 @@ Object { "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, "target": "opbeans-python", "targetData": Object { @@ -1427,6 +1865,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, }, @@ -1439,6 +1884,12 @@ Object { "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, "target": "opbeans-ruby", "targetData": Object { @@ -1462,6 +1913,12 @@ Object { "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, }, }, Object { @@ -1470,6 +1927,13 @@ Object { "id": "opbeans-python", "service.environment": "production", "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, Object { @@ -1478,6 +1942,13 @@ Object { "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 14901.319999999996, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, Object { @@ -1486,6 +1957,13 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 32226.649122807008, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-d457-high_mean_transaction_duration", + "transactionType": "request", + }, }, }, Object { diff --git a/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts b/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts index 11b5ca71e64e..2e4a859f08cc 100644 --- a/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts +++ b/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts @@ -153,33 +153,47 @@ export default function serviceMapsApiTests({ getService }: FtrProviderContext) (el: { data: { serviceAnomalyStats?: {} } }) => !isEmpty(el.data.serviceAnomalyStats) ); - expectSnapshot(dataWithAnomalies.length).toMatchInline(`2`); + expectSnapshot(dataWithAnomalies.length).toMatchInline(`6`); expectSnapshot(dataWithAnomalies.slice(0, 3)).toMatchInline(` Array [ Object { "data": Object { - "agent.name": "go", - "id": "opbeans-go", + "agent.name": "rum-js", + "id": "opbeans-rum", "service.environment": "testing", - "service.name": "opbeans-go", + "service.name": "opbeans-rum", "serviceAnomalyStats": Object { - "actualValue": 3933482.1764705875, - "anomalyScore": 2.6101702751482714, + "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-testing-d457-high_mean_transaction_duration", + "jobId": "apm-environment_not_defined-7ed6-high_mean_transaction_duration", + "transactionType": "page-load", + }, + }, + }, + Object { + "data": Object { + "agent.name": "python", + "id": "opbeans-python", + "service.environment": "production", + "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 66218.08333333333, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-229a-high_mean_transaction_duration", "transactionType": "request", }, }, }, Object { "data": Object { - "agent.name": "ruby", - "id": "opbeans-ruby", + "agent.name": "java", + "id": "opbeans-java", "service.environment": "production", - "service.name": "opbeans-ruby", + "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 684716.5813953485, - "anomalyScore": 0.20498907719907372, + "actualValue": 14901.319999999996, + "anomalyScore": 0, "healthStatus": "healthy", "jobId": "apm-production-229a-high_mean_transaction_duration", "transactionType": "request", diff --git a/x-pack/test/apm_api_integration/trial/tests/services/top_services.ts b/x-pack/test/apm_api_integration/trial/tests/services/top_services.ts index c93816dfb48b..ab127aaac849 100644 --- a/x-pack/test/apm_api_integration/trial/tests/services/top_services.ts +++ b/x-pack/test/apm_api_integration/trial/tests/services/top_services.ts @@ -59,13 +59,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(healthStatuses).toMatchInline(` Array [ - undefined, - undefined, "healthy", "healthy", - undefined, - undefined, - undefined, + "healthy", + "healthy", + "healthy", + "healthy", + "healthy", ] `); });