From ee4b451ed49375bcde5066a519bccb52568dfcde Mon Sep 17 00:00:00 2001 From: Giorgos Bamparopoulos Date: Wed, 21 Sep 2022 15:38:13 +0100 Subject: [PATCH] [APM] Synthtrace - Add service.name in metricsetPicker for breakdown metrics (#140256) * Add service.name in metricsetPicker for breakdown metrics * Run cypress tests on synthtrace changes --- .buildkite/scripts/pipelines/pull_request/pipeline.ts | 2 +- .../src/lib/apm/processors/get_breakdown_metrics.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts index 59cac2eaf5259..617a80524e6dd 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -90,7 +90,7 @@ const uploadPipeline = (pipelineContent: string | object) => { } if ( - (await doAnyChangesMatch([/^x-pack\/plugins\/apm/])) || + (await doAnyChangesMatch([/^x-pack\/plugins\/apm/, /^packages\/kbn-apm-synthtrace/])) || GITHUB_PR_LABELS.includes('ci:all-cypress-suites') ) { pipeline.push(getPipeline('.buildkite/pipelines/pull_request/apm_cypress.yml')); diff --git a/packages/kbn-apm-synthtrace/src/lib/apm/processors/get_breakdown_metrics.ts b/packages/kbn-apm-synthtrace/src/lib/apm/processors/get_breakdown_metrics.ts index 1772b5f655713..26a908bd085ab 100644 --- a/packages/kbn-apm-synthtrace/src/lib/apm/processors/get_breakdown_metrics.ts +++ b/packages/kbn-apm-synthtrace/src/lib/apm/processors/get_breakdown_metrics.ts @@ -105,15 +105,16 @@ export function getBreakdownMetrics(events: ApmFields[]) { lastMeasurement = timestamp; } + const instance = pickBy(event, instancePicker); + const key = { '@timestamp': event['@timestamp']! - (event['@timestamp']! % (30 * 1000)), 'transaction.type': transaction['transaction.type'], 'transaction.name': transaction['transaction.name'], ...pickBy(event, metricsetPicker), + ...instance, }; - const instance = pickBy(event, instancePicker); - const metricsetId = objectHash(key); let metricset = metricsets.get(metricsetId); @@ -121,7 +122,6 @@ export function getBreakdownMetrics(events: ApmFields[]) { if (!metricset) { metricset = { ...key, - ...instance, 'processor.event': 'metric', 'processor.name': 'metric', 'metricset.name': `span_breakdown`,