EG-4662 (11): Write async metrics exportation in AsyncMetricsReporter - #422
Merged
Merged
Conversation
AsyncMetricsExporter
ppicom
force-pushed
the
eg-4662-11-async-metrics-reporter
branch
2 times, most recently
from
August 20, 2026 07:03
5f8a66e to
d37c4bb
Compare
ppicom
force-pushed
the
eg-4662-11-async-metrics-reporter
branch
from
August 20, 2026 07:29
7debd9b to
8ab33c3
Compare
ppicom
force-pushed
the
eg-4662-11-async-metrics-reporter
branch
from
August 20, 2026 07:34
e35d525 to
c5d77f9
Compare
ppicom
force-pushed
the
eg-4662-11-async-metrics-reporter
branch
2 times, most recently
from
August 20, 2026 08:26
3141121 to
045100c
Compare
ppicom
force-pushed
the
eg-4662-11-async-metrics-reporter
branch
2 times, most recently
from
August 21, 2026 08:59
1f45c51 to
730dae2
Compare
ppicom
force-pushed
the
eg-4662-11-async-metrics-reporter
branch
from
August 21, 2026 09:42
730dae2 to
455f843
Compare
ppicom
force-pushed
the
eg-4662-11-async-metrics-reporter
branch
from
September 21, 2026 13:33
455f843 to
82b369c
Compare
ppicom
force-pushed
the
eg-4662-11-async-metrics-reporter
branch
from
September 21, 2026 14:28
82b369c to
fe82fdc
Compare
ppicom
force-pushed
the
eg-4662-11-async-metrics-reporter
branch
from
September 22, 2026 09:38
fe82fdc to
1a107c7
Compare
ppicom
force-pushed
the
eg-4662-11-async-metrics-reporter
branch
from
September 23, 2026 06:45
1a107c7 to
7db7cc0
Compare
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical metrics-loss and missing client-lifecycle integration issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
Adds asynchronous metrics reporting and wires it into AsyncUnleashClient, with reporter and client integration tests.
Changes:
- Implements periodic and shutdown metrics flushing.
- Adds impact-metrics handling and async reporter construction.
- Adds reporter behavior and client wiring tests.
| File | Summary | Findings |
|---|---|---|
UnleashClient/async_metrics_reporter.py |
Implements async metrics export and lifecycle handling. | Critical: Drained samples may be lost when send_metrics() raises (2 votes). Moderate: start() is not idempotent (2 votes); cancellation can drop in-flight metrics during shutdown (1 vote). |
UnleashClient/clients/async_unleash_client.py |
Constructs reporter and impact-metrics collaborators. | Critical: Reporter lifecycle is not integrated into client initialization or destruction (2 votes). |
tests/unit_tests/test_async_metrics_reporter.py |
Tests reporter behavior and scheduling. | Nit: Test drops the task handle without cancelling the task (1 vote). |
tests/unit_tests/clients/test_async_unleash_client.py |
Tests async client reporter wiring. | No findings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
alexanto
reviewed
Sep 23, 2026
alexanto
reviewed
Sep 23, 2026
AsyncMetricsExporterAsyncMetricsReporter
alexanto
reviewed
Sep 24, 2026
ppicom
force-pushed
the
eg-4662-11-async-metrics-reporter
branch
from
September 24, 2026 09:52
ecac1cf to
dcbe826
Compare
ppicom
commented
Sep 24, 2026
ppicom
commented
Sep 24, 2026
ppicom
commented
Sep 24, 2026
no need for a coroutine here.
alexanto
reviewed
Sep 24, 2026
Contributor
|
There are still some unresolved comments, please comment/fix/resolve those as well :) All in all it looks solid now, approving (really this time 😅 ) |
alexanto
approved these changes
Sep 24, 2026
Contributor
Author
|
on it! thanks Alexandra |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


basically, the python SDK had no support for the async keyword (big oversimplification here, but yeah).
So, we're writing an
AsyncUnleashClient. But, instead of copy and paste, what I'm doing is extracting common behavior into smaller classes that then both clients can shareThen, it so happens that some collaborators need to be different - mostly the network related ones: in this case, the reporting of metrics requires a network call; the sync one does it through
requests(a sync http library) and this async one does it with another one.Note: the HTTP is abstracted away behind the "transport" abstraction.