Skip to content

Commit

Permalink
chore: sampling should set the result
Browse files Browse the repository at this point in the history
  • Loading branch information
maraisr committed May 5, 2023
1 parent ee009ac commit 2a10857
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export function span(name: string, parent_id?: Traceparent | string) {
const should_sample =
typeof sampler !== 'boolean' ? sampler(name, id, scope) : sampler;

if (should_sample) id.flags | SAMPLED_FLAG;
else id.flags & ~SAMPLED_FLAG;
if (should_sample) id.flags |= SAMPLED_FLAG;
else id.flags &= ~SAMPLED_FLAG;

const span_obj: Span = {
id,
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export function tracer(name: string, options?: Options): Tracer {
const should_sample =
typeof sampler !== 'boolean' ? sampler(name, id, scope) : sampler;

if (should_sample) id.flags | SAMPLED_FLAG;
else id.flags & ~SAMPLED_FLAG;
if (should_sample) id.flags |= SAMPLED_FLAG;
else id.flags &= ~SAMPLED_FLAG;

const span_obj: Span = {
id,
Expand Down

0 comments on commit 2a10857

Please sign in to comment.