Add ability to flush during response cache for celery #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The way celery forks the existing main process ends up being problematic for the supergood python client.
It makes a copy of all the in-memory items on the client, but does NOT copy over the threads running on the main thread. This means remote configs will not get updated in the background, and flushes won't occur in the background. There's a few ways we're thinking of addressing this.
In the short term:
This PR ensures that the forked celery worker will still report events to supergood. The downside is we can't make use of batching like we can in the main thread, but it was a quick option to ensure we don't miss events.
In the medium term:
we're thinking about utilizing disk writes on forked threads so we can bundle those up on either the main thread or in a sidecar agent. This will remove the synchronous redact and post from the celery worker and offload it to the main thread / sidecar which are more long-running
In the long term:
we're investigating eBPF solutions
Tested on a dummy django server with simple celery workers making http calls