Skip to content

Commit

Permalink
PrioritySampler.keepTrace test
Browse files Browse the repository at this point in the history
  • Loading branch information
iunanua committed Oct 25, 2024
1 parent bfa5ae1 commit 822d3ac
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/dd-trace/test/priority_sampler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,22 @@ describe('PrioritySampler', () => {
expect(context._trace.tags[DECISION_MAKER_KEY]).to.equal('-0')
})
})

describe('keepTrace', () => {
it('should not fail if no _prioritySampler', () => {
expect(() => {
PrioritySampler.keepTrace(span, SAMPLING_MECHANISM_APPSEC)
}).to.not.throw()
})

it('should call setPriority with span USER_KEEP and mechanism', () => {
const setPriority = sinon.stub(prioritySampler, 'setPriority')

span._prioritySampler = prioritySampler

PrioritySampler.keepTrace(span, SAMPLING_MECHANISM_APPSEC)

expect(setPriority).to.be.calledOnceWithExactly(span, USER_KEEP, SAMPLING_MECHANISM_APPSEC)
})
})
})

0 comments on commit 822d3ac

Please sign in to comment.