From 606f02ef36f1ab068e6be15a7fd23752ff5074d6 Mon Sep 17 00:00:00 2001 From: Georgy Date: Tue, 15 Oct 2024 14:29:43 +0300 Subject: [PATCH] Add spanId getter for app context --- src/lib/context.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/context.ts b/src/lib/context.ts index c75901a..b022701 100644 --- a/src/lib/context.ts +++ b/src/lib/context.ts @@ -233,8 +233,11 @@ export class AppContext { } getTraceId() { - // @ts-ignore - return this.span?._spanContext?.toTraceId(); + return this.span?.context()?.toTraceId(); + } + + getSpanId() { + return this.span?.context()?.toSpanId(); } // allow add extra logger data, after ctx already initialized (ex. to add traceId from ctx)