Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

router: make shadow requests inherit parent sampling decision by default #37874

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

agrawroh
Copy link
Contributor

@agrawroh agrawroh commented Jan 4, 2025

Description

This PR changes the behavior of shadow request sampling so that if trace sampling is not explicitly configured in the shadow policy, the shadow request will inherit the parent's sampling decision.

After this change, sampling will follow the trace sampling policy of the original request, which prevents oversampling when runtime sampling is disabled.

Fixes: #37766


Commit Message: router: make shadow requests inherit parent sampling decision by default
Additional Description:
Risk Level: Low
Testing: Added Unit Tests
Docs Changes: Added
Release Notes: Added

Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @wbpcode
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #37874 was opened by agrawroh.

see: more, trace.

@agrawroh agrawroh force-pushed the mirroring_trace_sampling branch from 8202984 to f5e545a Compare January 4, 2025 12:05
envoy/router/router.h Outdated Show resolved Hide resolved
Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for take this. And some comments are added to start the work.

@wbpcode
Copy link
Member

wbpcode commented Jan 6, 2025

/wait

Signed-off-by: Rohit Agrawal <[email protected]>
Signed-off-by: Rohit Agrawal <[email protected]>
Copy link

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #37874 was synchronize by agrawroh.

see: more, trace.

@agrawroh agrawroh requested a review from wbpcode January 6, 2025 14:16
@nulltrope
Copy link

@wbpcode Not sure if this is something that is normally allowed but I work with @samschlegel (original issue reporter) and while this change is undoubtably useful for everyone as implemented, unfortunately the xDS control plane we are using (GCP Traffic Director) hardcodes the shadow policy's trace_sampled to true and they are not very quick to make changes to their API surface, if at all.

As a workaround in the meantime, would it be possible to add a second runtime flag to basically "force" ignoring the shadow policy's trace_sampled config (so essentially an extra if condition here ), or alternatively, a runtime flag similar to the existing tracing runtime flags that controls only shadow policy/mirrored tracing %?

Totally understand if the answer is "no" given we have a unique use case here with our control plane choice, but figured I would get a pulse on whether it could be considered :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants