diff --git a/packages/tracing/tests/helpers/FunctionSegmentNotDefinedError.ts b/packages/tracing/tests/helpers/FunctionSegmentNotDefinedError.ts index 8408b3c57b..1b3d6ad96b 100644 --- a/packages/tracing/tests/helpers/FunctionSegmentNotDefinedError.ts +++ b/packages/tracing/tests/helpers/FunctionSegmentNotDefinedError.ts @@ -1,3 +1,10 @@ +/** + * Thrown when the function segement (AWS::Lambda::Function) is not found in a trace. + * + * X-Ray segments are process asynchronously. They may not be available even after + * the trace has already appeared. In that case, the function segment may be missing. + * We will throw this error to notify caller. + */ export class FunctionSegmentNotDefinedError extends Error { public constructor(msg: string) { super(msg); diff --git a/packages/tracing/tests/helpers/tracesUtils.ts b/packages/tracing/tests/helpers/tracesUtils.ts index 8895d9e351..117b05501c 100644 --- a/packages/tracing/tests/helpers/tracesUtils.ts +++ b/packages/tracing/tests/helpers/tracesUtils.ts @@ -19,7 +19,7 @@ interface ParsedDocument { name: string id: string start_time: number - end_time: number + end_time?: number // This flag may be set if the segment hasn't been fully processed // The trace may have already appeared in the `getTraceSummaries` response // but a segment may still be in_progress