Skip to content

feat: new "immediate" trigger mode for decision log plugin #7516

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sspaink
Copy link
Contributor

@sspaink sspaink commented Apr 14, 2025

Why the changes in this PR are needed?

resolve: #7455

What are the changes in this PR?

This introduced a new trigger mode:

decision_logs.reporting.trigger=immediate

This trigger mode will upload events either if the upload size limit is reached or after the maximum delay.

Using this trigger mode disables configuring the decision_logs.reporting.min_delay_seconds and only the decision_logs.reporting.max_delay_seconds can be changed.

Notes to assist PR review:

The(p *Plugin) loop()method can now spin up a separate routine when using this new trigger mode that waits for a message from a buffer. Both the size and event buffer use the chunkEncoder which returns a result when a chunk is ready. The difference is that the size buffer adds the event to the encoder on log while the event buffer adds the event to the encoder on upload.

For the size buffer to support this mode I added a new channel (immediateResult) to notify there is a chunk ready. While the event buffer already uses a buffered channel it behaves the same reading from it until a chunk is ready.

Copy link

netlify bot commented Apr 14, 2025

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit 8a07e75
🔍 Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/67fd9efe02b2ee0008a7e1ba
😎 Deploy Preview https://deploy-preview-7516--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

If reporting.trigger="immediate" chunks of events will be uploaded as soon as they are ready.

Signed-off-by: sspaink <[email protected]>
@sspaink sspaink force-pushed the decisionplugin_uploadtrigger branch from 4b95972 to 8a07e75 Compare April 14, 2025 23:49
Signed-off-by: sspaink <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decision log plugin: trigger upload as soon as upload_size_limit_bytes is reached
1 participant