envoyproxy / envoyproxy/envoy

New CEL convenience function: random()

Open
#34,805 8 comments 0 reactions 0 assignees View on GitHub
area/cel enhancement no stalebot
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 22h
Merged PRs (30d)
430

Description

*Title*: *New CEL convenience function: random()*

*Description*:
* When called, use `Random::RandomGenerator` to generate a random uint64
* Useful in [Access Logger Filter](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/access_loggers/filters/cel/v3/cel.proto#extensions-access-loggers-filters-cel-v3-expressionfilter) to introduce sampling
* Although this is possible with the Runtime filter, this would be useful for end users

*Questions*:
* Should this convenience function be available everywhere? E.g. [the access log formatter](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/formatter/cel/v3/cel.proto#extensions-formatter-cel-v3-cel)?
* On the flip note, should this function, and others in the future, be explicitly requested by the user? E.g. a list of extensions provided with a cel expression under a new type:
```
message CelActivationSettings {
repeated google.protobuf.Any typed_functions = 1;
}

message CelRandomFunction {
}

...
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.