7487 opened a new pull request, #4018:
URL: https://github.com/apache/iggy/pull/4018

   ## Which issue does this PR address?
   
   Closes #4016
   
   ## Rationale
   
   `get_stats` is the server's headline diagnostic call and is exposed by every 
other SDK; the Python SDK could not reach it.
   
   ## What changed?
   
   The Python SDK had no binding for `get_stats`, so server counts, 
host/version details and cache metrics were unreachable from Python.
   
   A new `foreign/python/src/stats.rs` wraps `Stats`, `CacheMetrics` and 
`CacheMetricsKey` following the `user.rs` pattern. `CacheMetricsKey` is frozen 
with `__eq__`/`__hash__`, so `Stats.cache_metrics` converts to 
`dict[CacheMetricsKey, CacheMetrics]`. `IggyClient.get_stats` returns an 
awaitable resolving to `Stats`; byte sizes are exposed as integer bytes and 
times as microseconds, matching the existing getters. Stubs were regenerated 
with `cargo run --bin stub_gen` (purely additive diff after ruff).
   
   `tests/test_stats.py` creates a stream/topic, sends messages, and asserts 
the stream/topic/partition/message counts moved, the version string is 
non-empty, and the cache-metrics dict round-trips through key lookup.
   
   ## Local Execution
   
   - Passed
   - Pre-commit hooks ran
   
   Ran against a locally built `iggy-server` from this branch: `pytest tests/` 
gives 323 passed (only `test_tls` errors locally for lack of a Docker daemon, 
unrelated). `cargo fmt`, `cargo clippy --all-features --all-targets`, ruff 
check/format and pyrefly are clean.
   
   ## AI Usage
   
   1. Claude Code (Fable 5).
   2. Entire implementation and tests, following the pattern proposed in the 
issue.
   3. Built the extension and ran the new and full Python test suites against a 
locally built server; regenerated and diffed the stubs; ran 
clippy/fmt/ruff/pyrefly.
   4. Yes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to