Skip to content

Commit

Permalink
Revert "test(sampling): builtin samplers should forward traceState"
Browse files Browse the repository at this point in the history
This reverts commit e008229.
  • Loading branch information
raphael-theriault-swi committed Feb 2, 2023
1 parent b45c670 commit 3099265
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,4 @@ describe('AlwaysOffSampler', () => {
traceState: undefined,
});
});

it('should forward the traceState', () => {
const sampler = new AlwaysOffSampler();
const traceState = api.createTraceState();
assert.strictEqual(
sampler.shouldSample(
api.trace.setSpanContext(api.ROOT_CONTEXT, {
...api.INVALID_SPAN_CONTEXT,
traceState,
})
).traceState,
traceState
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,4 @@ describe('AlwaysOnSampler', () => {
traceState: undefined,
});
});

it('should forward the traceState', () => {
const sampler = new AlwaysOnSampler();
const traceState = api.createTraceState();
assert.deepStrictEqual(
sampler.shouldSample(
api.trace.setSpanContext(api.ROOT_CONTEXT, {
...api.INVALID_SPAN_CONTEXT,
traceState,
})
).traceState,
traceState
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ import * as assert from 'assert';
import * as api from '@opentelemetry/api';
import { TraceIdRatioBasedSampler } from '../../../src/sampler/TraceIdRatioBasedSampler';

const spanContext = (traceId = '1', traceState?: api.TraceState) =>
const spanContext = (traceId = '1') =>
api.trace.setSpanContext(api.ROOT_CONTEXT, {
traceId,
spanId: '1.1',
traceFlags: api.TraceFlags.NONE,
traceState,
});

const traceId = (part: string) => ('0'.repeat(32) + part).slice(-32);
Expand Down Expand Up @@ -173,16 +172,6 @@ describe('TraceIdRatioBasedSampler', () => {
);
});

it('should forward the traceState', () => {
const sampler = new TraceIdRatioBasedSampler(1);
const traceState = api.createTraceState();
assert.strictEqual(
sampler.shouldSample(spanContext(traceId('1'), traceState), traceId('1'))
.traceState,
traceState
);
});

it('should sample traces that a lower sampling ratio would sample', () => {
const sampler10 = new TraceIdRatioBasedSampler(0.1);
const sampler20 = new TraceIdRatioBasedSampler(0.2);
Expand Down

0 comments on commit 3099265

Please sign in to comment.