diff --git a/src/lib/context.ts b/src/lib/context.ts index 0e30fe9..35cbeaa 100644 --- a/src/lib/context.ts +++ b/src/lib/context.ts @@ -214,7 +214,8 @@ export class AppContext { getMetadata() { if (this.span) { - const metadata = {}; + const requestId = this.get('requestId'); + const metadata = requestId ? {requestId} : {}; this.tracer.inject(this.span, FORMAT_HTTP_HEADERS, metadata); return metadata; } else { diff --git a/src/types.ts b/src/types.ts index b849edd..3c29700 100644 --- a/src/types.ts +++ b/src/types.ts @@ -42,7 +42,9 @@ export interface AppConfig { appTelemetryChMirrorToLogs?: boolean; } -export interface AppContextParams {} +export interface AppContextParams { + requestId?: string; +} export interface AppDynamicConfig {}