Skip to content

Commit

Permalink
[APM][Otel] Fix an error with mobile services coming from synthtrace (e…
Browse files Browse the repository at this point in the history
…lastic#196313)

Closes elastic#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
  • Loading branch information
jennypavlova authored Oct 15, 2024
1 parent 10364fb commit c218e7c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export class MobileDevice extends Entity<ApmFields> {
spanSubtype: 'http',
'http.request.method': httpMethod,
'url.original': httpUrl,
'transaction.type': 'mobile',
'processor.event': 'span',
};

if (this.networkConnection) {
Expand Down

0 comments on commit c218e7c

Please sign in to comment.