diff --git a/README.md b/README.md index fd7116f..78f4468 100644 --- a/README.md +++ b/README.md @@ -215,9 +215,9 @@ Tail Sampling on the other hand is done at the end. Because we record every sing Example: ```typescript -const tailSampler = (localTrace: LocalTrace): boolean => { +const tailSampler = (traceInfo: LocalTrace): boolean => { const localRootSpan = traceInfo.localRootSpan as unknown as ReadableSpan - return localRootSpan.spanContext().traceFlags === TraceFlags.SAMPLED + return (localRootSpan.spanContext().traceFlags & TraceFlags.SAMPLED) === TraceFlags.SAMPLED } ``` diff --git a/src/sampling.ts b/src/sampling.ts index 4e05cd8..f8bb05d 100644 --- a/src/sampling.ts +++ b/src/sampling.ts @@ -17,7 +17,7 @@ export function multiTailSampler(samplers: TailSampleFn[]): TailSampleFn { export const isHeadSampled: TailSampleFn = (traceInfo) => { const localRootSpan = traceInfo.localRootSpan as unknown as ReadableSpan - return localRootSpan.spanContext().traceFlags === TraceFlags.SAMPLED + return (localRootSpan.spanContext().traceFlags & TraceFlags.SAMPLED) === TraceFlags.SAMPLED } export const isRootErrorSpan: TailSampleFn = (traceInfo) => {