Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
add tests for 64bit id probabilistic sampling
Browse files Browse the repository at this point in the history
  • Loading branch information
funny-falcon committed Mar 2, 2020
1 parent 23de8b9 commit d117971
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sampler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ func TestProbabilisticSampler(t *testing.T) {
assert.Equal(t, testProbabilisticExpectedTags, tags)
sampled, tags = sampler.IsSampled(TraceID{Low: testMaxID - 20}, testOperationName)
assert.True(t, sampled)

t.Run("test_64bit_id", func(t *testing.T) {
sampled, tags := sampler.IsSampled(TraceID{Low: (testMaxID + 10) | 1<<63}, testOperationName)
assert.False(t, sampled)
assert.Equal(t, testProbabilisticExpectedTags, tags)
sampled, tags = sampler.IsSampled(TraceID{Low: (testMaxID - 20) | 1<<63}, testOperationName)
assert.True(t, sampled)
})

assert.Equal(t, testProbabilisticExpectedTags, tags)
sampler2, _ := NewProbabilisticSampler(0.5)
assert.True(t, sampler.Equal(sampler2))
Expand Down

0 comments on commit d117971

Please sign in to comment.