-
Notifications
You must be signed in to change notification settings - Fork 1.8k
processor: add log_sampling processor for rate limiting #10732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughIntroduces a new log sampling processor plugin with build-time enablement, plugin registration, implementation (with fixed, sliding, and exponential strategies), and unit tests. Updates CMake options and plugin lists to compile and include the processor and its tests when enabled. Changes
Sequence Diagram(s)sequenceDiagram
participant C as Config
participant FB as Fluent Bit
participant PI as Processor Instance (log_sampling)
participant STR as Sampling Strategy
C->>FB: Enable FLB_PROCESSOR_LOG_SAMPLING + set params
FB->>PI: Create instance (cb_init)
PI->>PI: Parse config, allocate state
loop For each log chunk
FB->>PI: cb_process_logs(chunk)
PI->>STR: Decide(sample?) per record (fixed/sliding/exponential)
STR-->>PI: allow/drop decision
PI-->>FB: Filtered records + stats
end
FB->>PI: cb_exit
PI->>PI: Cleanup
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Add log_sampling processor with three window strategies: - Fixed window: samples first N logs per time window - Sliding window: maintains rolling rate limit - Exponential decay: reduces sampling rate over time Signed-off-by: Jorge Niedbalski <[email protected]>
Add unit tests for sampling algorithms: - Fixed window sampling and window resets - Sliding window with bucket expiration - Exponential decay rate calculations - Edge cases and boundary conditions Signed-off-by: Jorge Niedbalski <[email protected]>
dc2ab59
to
3ff1e70
Compare
@edsiper can I get your push here? Thanks |
This branch adds a new
log_sampling
processor for sampling log streams using some initial 3strategies.
Strategies implemented on this PR
Configuration examples
Fixed window sampling
Sliding window sampling
Exponential decay sampling
Testing
tests/internal/log_sampling.c
Use cases
Future work/ strategies
Summary by CodeRabbit