Skip to content

EG-4662 (11): Write async metrics exportation in AsyncMetricsReporter - #422

Merged
ppicom merged 6 commits into
mainfrom
eg-4662-11-async-metrics-reporter
Sep 24, 2026
Merged

ppicom merged 6 commits into
mainfrom
eg-4662-11-async-metrics-reporter

Conversation

@ppicom

@ppicom ppicom commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

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 share

Then, 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.

  • feat: new AsyncMetricsReporter
  • feat: wire AsyncMetricsReporter into AsyncUnleashClient
  • docs: tentative update to changelog

@ppicom ppicom changed the title eg 4662 11 async metrics reporter EG-4662 (11): Write async metrics exportation in AsyncMetricsExporter Aug 19, 2026
@gastonfournier gastonfournier moved this from New to In Progress in Issues and PRs Aug 20, 2026
@ppicom
ppicom force-pushed the eg-4662-11-async-metrics-reporter branch 2 times, most recently from 5f8a66e to d37c4bb Compare August 20, 2026 07:03
@ppicom
ppicom force-pushed the eg-4662-11-async-metrics-reporter branch from 7debd9b to 8ab33c3 Compare August 20, 2026 07:29
@ppicom
ppicom force-pushed the eg-4662-11-async-metrics-reporter branch from e35d525 to c5d77f9 Compare August 20, 2026 07:34
@ppicom
ppicom force-pushed the eg-4662-11-async-metrics-reporter branch 2 times, most recently from 3141121 to 045100c Compare August 20, 2026 08:26
@ppicom
ppicom force-pushed the eg-4662-11-async-metrics-reporter branch 2 times, most recently from 1f45c51 to 730dae2 Compare August 21, 2026 08:59
@ppicom
ppicom force-pushed the eg-4662-11-async-metrics-reporter branch from 730dae2 to 455f843 Compare August 21, 2026 09:42
@ppicom
ppicom force-pushed the eg-4662-11-async-metrics-reporter branch from 455f843 to 82b369c Compare September 21, 2026 13:33
@ppicom
ppicom force-pushed the eg-4662-11-async-metrics-reporter branch from 82b369c to fe82fdc Compare September 21, 2026 14:28
@ppicom
ppicom force-pushed the eg-4662-11-async-metrics-reporter branch from fe82fdc to 1a107c7 Compare September 22, 2026 09:38
Base automatically changed from eg-4662-10-metrics-reporter to main September 23, 2026 06:37
@ppicom
ppicom force-pushed the eg-4662-11-async-metrics-reporter branch from 1a107c7 to 7db7cc0 Compare September 23, 2026 06:45
@ppicom
ppicom requested a lite review from Copilot September 23, 2026 06:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity · 1 Medium severity

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.

Comment thread UnleashClient/async_metrics_reporter.py Outdated
Comment thread UnleashClient/clients/async_unleash_client.py
Comment thread UnleashClient/async_metrics_reporter.py Outdated
@ppicom
ppicom requested a review from alexanto September 23, 2026 09:34
Comment thread tests/unit_tests/test_async_metrics_reporter.py Outdated
Comment thread UnleashClient/async_metrics_reporter.py
@ppicom ppicom changed the title EG-4662 (11): Write async metrics exportation in AsyncMetricsExporter EG-4662 (11): Write async metrics exportation in AsyncMetricsReporter Sep 23, 2026
Comment thread UnleashClient/async_metrics_reporter.py Outdated
@ppicom
ppicom force-pushed the eg-4662-11-async-metrics-reporter branch from ecac1cf to dcbe826 Compare September 24, 2026 09:52
Comment thread tests/unit_tests/clients/test_async_unleash_client.py
Comment thread tests/unit_tests/clients/test_async_unleash_client.py
Comment thread tests/unit_tests/test_async_metrics_reporter.py
@ppicom
ppicom requested a review from alexanto September 24, 2026 10:10
Comment thread UnleashClient/async_metrics_reporter.py
@alexanto

Copy link
Copy Markdown
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 😅 )

ppicom commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

on it! thanks Alexandra

@ppicom
ppicom merged commit f06d124 into main Sep 24, 2026
8 checks passed
@ppicom
ppicom deleted the eg-4662-11-async-metrics-reporter branch September 24, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants