envoy icon indicating copy to clipboard operation
envoy copied to clipboard

ext_proc - sampling support

Open rshriram opened this issue 2 years ago • 9 comments

Title: ext_proc - sampling support

Description: We need the ability to sample ext_proc calls. A simple sample_rate field (0.0 to 1.0) within ext_proc filter that activates the filter and makes the external call only when necessary. This becomes especially useful when we finish implementing the async support, allowing users to selectively sample a fraction of traffic for observation.

Once sampled, the stream should be active for the entire request, honoring all the processing modes, etc.

cc @tyxia @htuch

rshriram avatar Oct 12 '23 16:10 rshriram

Should the sampling be inside the unified matcher? There's a common need to sample logs statefully and probabilistically, for example in https://github.com/envoyproxy/envoy/issues/30006.

kyessenov avatar Oct 12 '23 16:10 kyessenov

Yeah, preference is this is outside of ext_proc and part of the match model.

htuch avatar Oct 12 '23 18:10 htuch

/assign @tyxia

tyxia avatar Oct 14 '23 16:10 tyxia

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 16 '23 20:11 github-actions[bot]

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.

github-actions[bot] avatar Nov 24 '23 00:11 github-actions[bot]

I am a little bit confused on the comments.

The original issue description is for adding sampling support for ext_proc to makes the external call only when necessary. To implement that, we can simply toss a coin in the ext_proc filter and make the external call based on the coin toss result.

@kyessenov @htuch could you please elaborate the idea to implement it in the unified matcher?

yanjunxiang-google avatar Apr 26 '24 14:04 yanjunxiang-google

/assign @yanjunxiang-google

yanjunxiang-google avatar Apr 26 '24 14:04 yanjunxiang-google

I think @kyessenov is suggesting we just have the coin flip in the matcher, which will be more generic, as there are other legit use cases for sampling.

htuch avatar Apr 30 '24 02:04 htuch

I think it can be understood as: Performing the sampling at the higher level and centralized place. This will benefit all delegated filters (like ext_proc, ext_authz, etc) as the delegated filters are invoked based on sampling result

tyxia avatar Apr 30 '24 03:04 tyxia