Skip to content

Commit a838c17

Browse files
authored
ref(core): Allow number as span traceFlag (#10855)
To align this with OTEL types.
1 parent 784b485 commit a838c17

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/types/src/span.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ export interface SpanJSON {
5858
}
5959

6060
// These are aligned with OpenTelemetry trace flags
61-
type TraceFlagNone = 0x0;
62-
type TraceFlagSampled = 0x1;
61+
type TraceFlagNone = 0;
62+
type TraceFlagSampled = 1;
6363
export type TraceFlag = TraceFlagNone | TraceFlagSampled;
6464

6565
export interface SpanContextData {
@@ -90,8 +90,9 @@ export interface SpanContextData {
9090
* sampled or not. When set, the least significant bit documents that the
9191
* caller may have recorded trace data. A caller who does not record trace
9292
* data out-of-band leaves this flag unset.
93+
* We allow number here because otel also does, so we can't be stricter than them.
9394
*/
94-
traceFlags: TraceFlag;
95+
traceFlags: TraceFlag | number;
9596

9697
// Note: we do not have traceState here, but this is optional in OpenTelemetry anyhow
9798
}

0 commit comments

Comments
 (0)