Open wtzhang23 opened 3 weeks ago
@wtzhang23
Is this issue for sampling in access log OR for general random purpose? This is ongoing effort https://github.com/envoyproxy/envoy/pull/34611 for former.
Also, that will be great to introduce random feature in general rather than limiting to accessLog
Intended specifically for only using the CEL access log filter. I know it is possible to compose multiple access log filters together but I'd like to use CEL by itself for convenience sake. Especially should the expression change frequently.
I agree random is one of those features that would be useful everywhere, but it might be a good idea to not set the expectation that functions should be available everywhere. I also think that there is all sorts of functions that people would like and it would make sense to provide them the extensibility to compile in their own helper functions. Though we could probably keep it simple for this issue.
If you are adding a CEL convenience function, it seems that it should not only be tied with access log, even if it is not available everywhere Limiting the scope to CEL SGTM
cced @kyessenov as well
Will try to add it everywhere I can once I open a PR
Seems like x-request-id
is already present so it may be better to simply use that? As in, in addition to the request.id
attribute, we can add another attribute that converts it into a uint that can be used for randomness (e.g. use the request id extension's getInteger
function)?
Anyways, I'm almost done with the function; just need to write unit tests.
Title: New CEL convenience function: random()
Description:
Random::RandomGenerator
to generate a random uint64Questions:
message CelRandomFunction { }
...