Skip to content

Commit

Permalink
Modify comment (review feedback)
Browse files Browse the repository at this point in the history
Signed-off-by: thomas.ebner <[email protected]>
  • Loading branch information
samohte committed Feb 12, 2024
1 parent 59edc28 commit c2246d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ void addSamplingAttributes(uint32_t sampling_exponent,
std::map<std::string, std::string>& attributes) {

const auto multiplicity = SamplingState::toMultiplicity(sampling_exponent);
// The denominator of the sampling ratio. If for example the Dynatrace OneAgent samples with a
// probability the value of supportability.atm_sampling_ratio would be 16
// ratio is also called multiplicity
// The denominator of the sampling ratio. If, for example, the Dynatrace OneAgent samples with a
// probability of 1/16, the value of supportability.atm_sampling_ratio would be 16.
// Note: Ratio is also known as multiplicity.
attributes["supportability.atm_sampling_ratio"] = std::to_string(multiplicity);

if (multiplicity > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,7 @@ TEST_F(DynatraceSamplerTest, TestWithoutParentContext) {
EXPECT_TRUE(sampling_result.isSampled());
}

// Verify sampler being invoked with existing Dynatrace trace state tag set
TEST_F(DynatraceSamplerTest, TestWithParentContext) {
SpanContext parent_context = SpanContext("00", trace_id, "b7ad6b7169203331", true,
"ot=foo:bar,5b3f9fed-980df25c@dt=fw4;0;0;0;0;0;0;ad");

SamplingResult sampling_result =
sampler_->shouldSample(parent_context, trace_id, "parent_span",
::opentelemetry::proto::trace::v1::Span::SPAN_KIND_SERVER, {}, {});
EXPECT_EQ(sampling_result.decision, Decision::RecordAndSample);
EXPECT_EQ(sampling_result.attributes->size(), 1);
EXPECT_STREQ(
sampling_result.attributes->find("supportability.atm_sampling_ratio")->second.c_str(), "1");
EXPECT_STREQ(sampling_result.tracestate.c_str(),
"ot=foo:bar,5b3f9fed-980df25c@dt=fw4;0;0;0;0;0;0;ad");
EXPECT_TRUE(sampling_result.isRecording());
EXPECT_TRUE(sampling_result.isSampled());
}

// Verify sampler being invoked with parent span context
// Verify sampler being invoked without a Dynatrace tracestate
TEST_F(DynatraceSamplerTest, TestWithUnknownParentContext) {
SpanContext parent_context("00", trace_id, parent_span_id, true, "some_vendor=some_value");

Expand Down

0 comments on commit c2246d0

Please sign in to comment.