From 2f3f5c669f08233a63693608c3152a7a31a20dc0 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 29 Feb 2024 09:29:28 +0000 Subject: [PATCH] ref(core): Allow `number` as span `traceFlag` To align this with OTEL types. --- packages/types/src/span.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/types/src/span.ts b/packages/types/src/span.ts index dfc5ad5f9e6f..cf4f117637ed 100644 --- a/packages/types/src/span.ts +++ b/packages/types/src/span.ts @@ -58,8 +58,8 @@ export interface SpanJSON { } // These are aligned with OpenTelemetry trace flags -type TraceFlagNone = 0x0; -type TraceFlagSampled = 0x1; +type TraceFlagNone = 0; +type TraceFlagSampled = 1; export type TraceFlag = TraceFlagNone | TraceFlagSampled; export interface SpanContextData { @@ -90,8 +90,9 @@ export interface SpanContextData { * sampled or not. When set, the least significant bit documents that the * caller may have recorded trace data. A caller who does not record trace * data out-of-band leaves this flag unset. + * We allow number here because otel also does, so we can't be stricter than them. */ - traceFlags: TraceFlag; + traceFlags: TraceFlag | number; // Note: we do not have traceState here, but this is optional in OpenTelemetry anyhow }