Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ describe('AwsBatchUnsampledSpanProcessor', () => {
const processor = new AwsBatchUnsampledSpanProcessor(exporter, {
maxExportBatchSize: 5,
maxQueueSize: 6,
exportTimeoutMillis: 1000,
});
const totalSpans = 50;
for (let i = 0; i < totalSpans; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ describe('AwsXrayRemoteSampler', () => {
).toEqual(SamplingDecision.NOT_RECORD);

setTimeout(() => {
// restore function
(_AwsXRayRemoteSampler.prototype as any).getDefaultTargetPollingInterval = tmp;

expect(
sampler.shouldSample(context.active(), '1234', 'name', SpanKind.CLIENT, { abc: '1234' }, []).decision
).toEqual(SamplingDecision.RECORD_AND_SAMPLED);
Expand All @@ -98,8 +101,6 @@ describe('AwsXrayRemoteSampler', () => {
sampler.shouldSample(context.active(), '1234', 'name', SpanKind.CLIENT, { abc: '1234' }, []).decision
).toEqual(SamplingDecision.RECORD_AND_SAMPLED);

// reset function
(_AwsXRayRemoteSampler.prototype as any).getDefaultTargetPollingInterval = tmp;
done();
}, 300);
}, 10);
Expand Down Expand Up @@ -139,10 +140,12 @@ describe('AwsXrayRemoteSampler', () => {
sampled++;
}
}

// restore function
(_AwsXRayRemoteSampler.prototype as any).getDefaultTargetPollingInterval = tmp;

expect((sampler as any)._root._root.ruleCache.ruleAppliers[0].reservoirSampler.quota).toEqual(100000);
expect(sampled).toEqual(100000);
// reset function
(_AwsXRayRemoteSampler.prototype as any).getDefaultTargetPollingInterval = tmp;
done();
}, 2000);
}, 100);
Expand Down Expand Up @@ -184,13 +187,13 @@ describe('AwsXrayRemoteSampler', () => {
sampled++;
}
}
expect(sampled).toEqual(100);
// reset function
(_AwsXRayRemoteSampler.prototype as any).getDefaultTargetPollingInterval = tmp;
clock.restore();
// restore function
(_AwsXRayRemoteSampler.prototype as any).getDefaultTargetPollingInterval = tmp;
expect(sampled).toEqual(100);
done();
}, 2000);
}, 100);
}, 300);
});

it('generates valid ClientId', () => {
Expand Down
Loading