Skip to content
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

🏭 Refactor metrics/events send mechanism #23

Merged
merged 1 commit into from
Jan 11, 2025
Merged

Conversation

kamaradclimber
Copy link
Owner

Before this patch, events and PR were sent asynchronously from callbacks.
It led to metrics not being batched (there were mostly sent one by one). It also led to loss of metrics (and sometimes fully blockage of metrics/events sending mechanism).

Now we have a queue to store pending metrics/events and both are dequeued every 10s.

This should greatly improve stability.

From the code writing perspective it requires to:

  • write a callback that will be called every 10s
  • from this callback schedule the execution (eagerly) of an async method
  • in the async method we can finally loop over all pending metrics/events

Before this patch, events and PR were sent asynchronously from
callbacks.
It led to metrics not being batched (there were mostly sent one by one).
It also led to loss of metrics (and sometimes fully blockage of
metrics/events sending mechanism).

Now we have a queue to store pending metrics/events and both are
dequeued every 10s.

This should greatly improve stability.

From the code writing perspective it requires to:
- write a callback that will be called every 10s
- from this callback schedule the execution (eagerly) of an async method
- in the async method we can finally loop over all pending
  metrics/events
@kamaradclimber kamaradclimber merged commit 1495458 into master Jan 11, 2025
4 checks passed
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.

1 participant