Skip to content

Commit

Permalink
Fix error correlation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jennypavlova committed Oct 11, 2024
1 parent 06ec4ef commit 7e4e43e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -79,6 +80,7 @@ export async function getErrorSampleDetails({

const optionalFields = asMutableArray([
TRANSACTION_ID,
SPAN_ID,
AGENT_VERSION,
PROCESSOR_NAME,
ERROR_STACK_TRACE,
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7e4e43e

Please sign in to comment.