Add a log rate limiter #25

Closed
quentin wants to merge 0 commits from log-rate-limiter into main
Owner

Features:

  • Apply only to info/debug/trace logs
  • Default to 1 log per second, can be changed with TRICOT_MAX_LOG_PER_SEC. For example TRICOT_MAX_LOG_PER_SEC=10 allows up to 10 log lines per second

Further work: governor seems to be a state of the art rate limiter for Rust. I think we could deploy it also on a per IPv4 and per-IPv6 prefix base to protect all our stacks. For example, we could allow only 10 req/sec per IP with some burst logic & so on & so forth

Features: - Apply only to info/debug/trace logs - Default to 1 log per second, can be changed with `TRICOT_MAX_LOG_PER_SEC`. For example `TRICOT_MAX_LOG_PER_SEC=10` allows up to 10 log lines per second Further work: governor seems to be a state of the art rate limiter for Rust. I think we could deploy it also on a per IPv4 and per-IPv6 prefix base to protect all our stacks. For example, we could allow only 10 req/sec per IP with some burst logic & so on & so forth
quentin added 1 commit 2025-04-11 13:41:03 +00:00
requested review from Armael 2025-04-11 13:41:08 +00:00
Armael reviewed 2025-04-11 14:19:41 +00:00
@ -110,1 +113,4 @@
pub warmup_cert_memory_store: bool,
/// Drops some logs to avoid overloading the server.
/// Aapplies only to info/debugt/trace logs
Owner

Aapplies -> applies

Aapplies -> applies
@ -111,0 +116,4 @@
/// Aapplies only to info/debugt/trace logs
/// 100 = keep all logs
/// 50 = keep roughly half the logs
/// 0 = drop all logs
Owner

the docstring seems inconsistent with what comes after (keep percentage vs quota per second)

the docstring seems inconsistent with what comes after (keep percentage vs quota per second)
@ -111,0 +133,4 @@
governor::state::NotKeyed,
governor::state::InMemoryState,
governor::clock::QuantaClock,
>,
Owner

is this not the same as DefaultDirectRateLimiter?

is this not the same as `DefaultDirectRateLimiter`?
Owner

Manually merged to main.

Manually merged to main.
Armael closed this pull request 2025-04-12 14:56:22 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Deuxfleurs/tricot#25
No description provided.