This repository was archived by the owner on Aug 30, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
src/jaegertracing/samplers Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ class ProbabilisticSampler : public Sampler {
55
55
56
56
static uint64_t computeSamplingBoundary (long double samplingRate)
57
57
{
58
- const long double maxRandNumber = kMaxRandomNumber ;
58
+ const auto maxRandNumber = static_cast < long double >( kMaxRandomNumber ) ;
59
59
const auto samplingBoundary = samplingRate * maxRandNumber;
60
60
61
61
// Protect against overflow in case samplingBoundary rounds
Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ namespace {
38
38
constexpr auto kTestOperationName = " op" ;
39
39
constexpr auto kTestFirstTimeOperationName = " firstTimeOp" ;
40
40
constexpr auto kTestDefaultSamplingProbability = 0.5 ;
41
- constexpr auto kTestMaxID = std::numeric_limits<uint64_t >::max() / 2 + 1 ;
41
+ constexpr auto kTestMaxID =
42
+ static_cast <long double >(std::numeric_limits<uint64_t >::max()) / 2.0 + 1 ;
42
43
constexpr auto kTestDefaultMaxOperations = 10 ;
43
44
44
45
const Tag testProbablisticExpectedTags[] = {
@@ -216,7 +217,8 @@ TEST(Sampler, testAdaptiveSampler)
216
217
ASSERT_FALSE (result.isSampled ());
217
218
218
219
result =
219
- sampler.isSampled (TraceID (0 , kTestMaxID ), kTestFirstTimeOperationName );
220
+ sampler.isSampled (TraceID (0 , kTestMaxID - 20 ),
221
+ kTestFirstTimeOperationName );
220
222
ASSERT_TRUE (result.isSampled ());
221
223
CMP_TAGS (testProbablisticExpectedTags, result.tags ());
222
224
}
You can’t perform that action at this time.
0 commit comments