contrib/envoyproxy(feat): Implement API Sec proxy route sampler#3698
contrib/envoyproxy(feat): Implement API Sec proxy route sampler#3698
Conversation
BenchmarksBenchmark execution time: 2025-06-27 15:38:12 Comparing candidate commit 71622f3 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics. |
Datadog ReportBranch report: ❌ 1 Failed (0 Known Flaky), 5422 Passed, 66 Skipped, 4m 23.29s Total Time ❌ Failed Tests (1)
|
b9edafa to
6ec7e89
Compare
6ec7e89 to
a973312
Compare
| t.Run("rate-limits", func(t *testing.T) { | ||
| t.Setenv(config.EnvEnabled, "true") | ||
| t.Setenv(internal.EnvAPISecEnabled, "true") | ||
| t.Setenv(internal.EnvAPISecProxySampleRate, "1") |
There was a problem hiding this comment.
Ugh I should've asked for this constant name to mention the unit of the value; because here I have no clue...
I'd appreciate if you can:
- Add a comment here mentioning the unit (samples-per-second?)
- Maybe make a small PR to
appsec-internal-goto document it on the constant if not done already.
And then, depending on the unit -- this may be too low to guarantee it'll always behave right on slow CI hosts... Should probably not be afraid to pump it up ridiculously.
There was a problem hiding this comment.
The value of EnvAPISecProxySampleRate is a sample rate by minute. I opened this PR to refine the doc: DataDog/appsec-internal-go#53
I also updated the test to test that after 1 min, the sampler is restaured.
There was a problem hiding this comment.
I also updated the test to test that after 1 min, the sampler is restaured.
You sure about that? I don't see it... And you most certainly don't want your test to include a time.Sleep(time.Minute) -- that is a lot of time in CI!
There was a problem hiding this comment.
I pushed the commit just after the comment 😄
The thing is that the minute of the sampler is not configurable, it will be always 1 min.
# Changes Related to the PR DataDog/dd-trace-go#3698, the documentation of the proxy sample rate has been updated.
What does this PR do?
This PR add a new API Security route sampler for proxies. It is defined in this RFC.
Using the new release of
appsec-internal-gov1.13.0(PR DataDog/appsec-internal-go#52)Motivation
Correctly sample the requests for schema generation inside proxy environment.
Currently, the sampler applied is by key on the path (fallback on the path because the route is not available). This PR means to change it.
Reviewer's Checklist
golangci-lint runlocally.Unsure? Have a question? Request a review!