Skip to content

Commit

Permalink
Change random_sampling default to 100/100, and add TODO comment
Browse files Browse the repository at this point in the history
Signed-off-by: Gary Brown <gary@brownuk.com>
  • Loading branch information
objectiser committed May 27, 2019
1 parent 2e19997 commit 9d582c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions source/common/router/config_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ RouteTracingImpl::RouteTracingImpl(const envoy::api::v2::route::Tracing& tracing
client_sampling_ = tracing.client_sampling();
}
if (!tracing.has_random_sampling()) {
random_sampling_.set_numerator(10000);
random_sampling_.set_denominator(envoy::type::FractionalPercent::TEN_THOUSAND);
random_sampling_.set_numerator(100);
random_sampling_.set_denominator(envoy::type::FractionalPercent::HUNDRED);
} else {
random_sampling_ = tracing.random_sampling();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ HttpConnectionManagerConfig::HttpConnectionManagerConfig(
client_sampling.set_numerator(
tracing_config.has_client_sampling() ? tracing_config.client_sampling().value() : 100);
envoy::type::FractionalPercent random_sampling;
// TODO: Random sampling historically was an integer and default to out of 10,000. We should
// deprecate that and move to a straight fractional percent config.
random_sampling.set_numerator(
tracing_config.has_random_sampling() ? tracing_config.random_sampling().value() : 10000);
random_sampling.set_denominator(envoy::type::FractionalPercent::TEN_THOUSAND);
Expand Down
4 changes: 2 additions & 2 deletions test/common/router/config_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4855,8 +4855,8 @@ name: foo
const auto route3 = config.route(genHeaders("www.foo.com", "/third", "GET"), 0);

// Check default values for random and overall sampling
EXPECT_EQ(10000, route1->tracingConfig()->getRandomSampling().numerator());
EXPECT_EQ(1, route1->tracingConfig()->getRandomSampling().denominator());
EXPECT_EQ(100, route1->tracingConfig()->getRandomSampling().numerator());
EXPECT_EQ(0, route1->tracingConfig()->getRandomSampling().denominator());
EXPECT_EQ(100, route1->tracingConfig()->getOverallSampling().numerator());
EXPECT_EQ(0, route1->tracingConfig()->getOverallSampling().denominator());

Expand Down

0 comments on commit 9d582c3

Please sign in to comment.