From c218e7cc29c00864d744d886c6e712b99ba97ed5 Mon Sep 17 00:00:00 2001 From: jennypavlova Date: Tue, 15 Oct 2024 17:53:12 +0200 Subject: [PATCH] [APM][Otel] Fix an error with mobile services coming from synthtrace (#196313) Closes #196161 ## Summary This PR fixes an issue with the mobile data using synthtrace. After some investigation I saw that the the `httpSpan` was creating the spans with `transaction.type` set which resulted in `processor.event` being set to `transaction` instead of `span` - then with [the new required transaction fields](https://github.com/elastic/kibana/blob/adb558a86bafbe3567915c3fae252ff414147930/x-pack/plugins/observability_solution/apm/server/routes/traces/get_trace_items.ts#L277) in get_trace_docs for transactions ([checking based on the processor.event](https://github.com/elastic/kibana/blob/adb558a86bafbe3567915c3fae252ff414147930/x-pack/plugins/observability_solution/apm/server/routes/traces/get_trace_items.ts#L352)) we were throwing an error because the transaction fields were not defined (which is expected because it's a span and not a transaction) ## Testing Generate mobile data using: `node scripts/synthtrace mobile.ts --clean` Open all the mobile traces (ios/Android) - there should not be an error --- packages/kbn-apm-synthtrace-client/src/lib/apm/mobile_device.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-apm-synthtrace-client/src/lib/apm/mobile_device.ts b/packages/kbn-apm-synthtrace-client/src/lib/apm/mobile_device.ts index 448c7e59a8ee8..b4dfafe22fc44 100644 --- a/packages/kbn-apm-synthtrace-client/src/lib/apm/mobile_device.ts +++ b/packages/kbn-apm-synthtrace-client/src/lib/apm/mobile_device.ts @@ -230,7 +230,7 @@ export class MobileDevice extends Entity { spanSubtype: 'http', 'http.request.method': httpMethod, 'url.original': httpUrl, - 'transaction.type': 'mobile', + 'processor.event': 'span', }; if (this.networkConnection) {