From 73a887ee0a69f78a94846b4731890fa639dbba3a Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 10 May 2022 18:24:50 +0200 Subject: [PATCH 1/2] test: add class documentation on FunctionSegmentNotDefinedError --- .../tests/helpers/FunctionSegmentNotDefinedError.ts | 7 +++++++ 1 file changed, 7 insertions(+) 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); From 7b5deee3ad739ac348a34cf2d5bbd3be2cb12141 Mon Sep 17 00:00:00 2001 From: ijemmy Date: Tue, 10 May 2022 18:26:34 +0200 Subject: [PATCH 2/2] test: end_time should be optional. It won't be defined if the segment hasn't been closed --- packages/tracing/tests/helpers/tracesUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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