diff --git a/x-pack/plugins/observability_solution/apm/server/routes/errors/get_error_groups/get_error_sample_details.ts b/x-pack/plugins/observability_solution/apm/server/routes/errors/get_error_groups/get_error_sample_details.ts index 3980c7ff1dfb6..f52767cd2cb46 100644 --- a/x-pack/plugins/observability_solution/apm/server/routes/errors/get_error_groups/get_error_sample_details.ts +++ b/x-pack/plugins/observability_solution/apm/server/routes/errors/get_error_groups/get_error_sample_details.ts @@ -27,6 +27,7 @@ import { TRACE_ID, TRANSACTION_ID, ERROR_STACK_TRACE, + SPAN_ID, } from '../../../../common/es_fields/apm'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { ApmDocumentType } from '../../../../common/document_type'; @@ -79,6 +80,7 @@ export async function getErrorSampleDetails({ const optionalFields = asMutableArray([ TRANSACTION_ID, + SPAN_ID, AGENT_VERSION, PROCESSOR_NAME, ERROR_STACK_TRACE, @@ -129,7 +131,7 @@ export async function getErrorSampleDetails({ const errorFromFields = unflattenKnownApmEventFields(hit.fields, requiredFields); - const transactionId = errorFromFields.transaction?.id; + const transactionId = errorFromFields.transaction?.id ?? errorFromFields.span?.id; const traceId = errorFromFields.trace.id; let transaction: Transaction | undefined; diff --git a/x-pack/plugins/observability_solution/apm/server/routes/traces/get_trace_items.ts b/x-pack/plugins/observability_solution/apm/server/routes/traces/get_trace_items.ts index 7d2c0443dfa32..55fb0aab47f38 100644 --- a/x-pack/plugins/observability_solution/apm/server/routes/traces/get_trace_items.ts +++ b/x-pack/plugins/observability_solution/apm/server/routes/traces/get_trace_items.ts @@ -159,6 +159,10 @@ export async function getTraceItems({ const waterfallErrorEvent: WaterfallError = { ...event, + parent: { + ...event?.parent, + id: event?.parent?.id ?? event?.span?.id, + }, error: { ...(event.error ?? {}), exception: