Skip to content

Commit

Permalink
test/sample_test.cpp: address review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dgoffredo committed Oct 26, 2021
1 parent 9033b81 commit a034262
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions test/sample_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,22 +228,14 @@ TEST_CASE("rules sampler") {
])";
const auto tracer = std::make_shared<Tracer>(tracer_options, writer, sampler);

// The first span will be allowed by the limiter (tested in the previou section).
auto span = tracer->StartSpanWithOptions("operation name", span_options);
span->FinishWithOptions(finish_options);
// The first trace will be allowed by the limiter.
{
REQUIRE(mwriter->traces.size() == 1);
REQUIRE(mwriter->traces[0].size() == 1);
const auto& metrics = mwriter->traces[0][0]->metrics;
REQUIRE(metrics.count("_sampling_priority_v1"));
REQUIRE(metrics.at("_sampling_priority_v1") ==
static_cast<double>(SamplingPriority::UserKeep));
}

span = tracer->StartSpanWithOptions("operation name", span_options);
span->FinishWithOptions(finish_options);
// The second trace will be dropped by the limiter, and the priority will
// be `UserDrop`.
span = tracer->StartSpanWithOptions("operation name", span_options);
span->FinishWithOptions(finish_options);
{
REQUIRE(mwriter->traces.size() == 2);
REQUIRE(mwriter->traces[1].size() == 1);
Expand Down

0 comments on commit a034262

Please sign in to comment.