Skip to content

ref(core): Allow number as span traceFlag #10855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/types/src/span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down