Skip to content

Commit

Permalink
addressed comments from @wbpcode
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>
  • Loading branch information
agrawroh committed Jan 8, 2025
1 parent 75fd4c8 commit bacb67b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/common/router/config_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ ShadowPolicyImpl::ShadowPolicyImpl(const RequestMirrorPolicy& config, absl::Stat
// inherit the parent's sampling decision. This prevents oversampling when runtime sampling is
// disabled.
if (config.has_trace_sampled()) {
trace_sampled_ = absl::optional<bool>(config.trace_sampled().value());
trace_sampled_ = config.trace_sampled().value();
} else {
// If the shadow policy does not specify trace_sampled, we will inherit the parent's sampling
// decision.
Expand Down
8 changes: 2 additions & 6 deletions source/common/router/router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,6 @@ void Filter::chargeUpstreamCode(Http::Code code, Upstream::HostDescriptionOptCon
chargeUpstreamCode(response_status_code, *fake_response_headers, upstream_host, dropped);
}

absl::optional<bool> getSampleValueFromShadowPolicy(const ShadowPolicy& shadow_policy) {
return shadow_policy.traceSampled();
}

Http::FilterHeadersStatus Filter::decodeHeaders(Http::RequestHeaderMap& headers, bool end_stream) {
downstream_headers_ = &headers;

Expand Down Expand Up @@ -804,7 +800,7 @@ Http::FilterHeadersStatus Filter::decodeHeaders(Http::RequestHeaderMap& headers,
.setTimeout(timeout_.global_timeout_)
.setParentSpan(callbacks_->activeSpan())
.setChildSpanName("mirror")
.setSampled(getSampleValueFromShadowPolicy(shadow_policy))
.setSampled(shadow_policy.traceSampled())
.setIsShadow(true)
.setIsShadowSuffixDisabled(shadow_policy.disableShadowHostSuffixAppend())
.setBufferAccount(callbacks_->account())
Expand Down Expand Up @@ -1072,7 +1068,7 @@ void Filter::maybeDoShadowing() {
.setTimeout(timeout_.global_timeout_)
.setParentSpan(callbacks_->activeSpan())
.setChildSpanName("mirror")
.setSampled(getSampleValueFromShadowPolicy(shadow_policy))
.setSampled(shadow_policy.traceSampled())
.setIsShadow(true)
.setIsShadowSuffixDisabled(shadow_policy.disableShadowHostSuffixAppend());
options.setFilterConfig(config_);
Expand Down

0 comments on commit bacb67b

Please sign in to comment.