feat(python): expose get_stats on IggyClient - #4018
Open
7487 wants to merge 1 commit into
Open
Conversation
The Python SDK had no way to reach the server's headline diagnostic call, exposed by every other SDK. Wrap Stats, CacheMetrics and CacheMetricsKey in a new stats module following the user.rs pattern. CacheMetricsKey is frozen, hashable and comparable so cache_metrics maps to dict[CacheMetricsKey, CacheMetrics]. Byte sizes are exposed as integer bytes, times as microseconds, matching the existing getters. Closes apache#4016
|
Thanks for the PR. It is labeled Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
2 tasks
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (43.75%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #4018 +/- ##
============================================
- Coverage 85.00% 84.97% -0.03%
Complexity 1402 1402
============================================
Files 1225 1226 +1
Lines 180283 180411 +128
Branches 146587 146587
============================================
+ Hits 153248 153304 +56
- Misses 22993 23065 +72
Partials 4042 4042
🚀 New features to boost your workflow:
|
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.
Which issue does this PR address?
Closes #4016
Rationale
get_statsis 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.rswrapsStats,CacheMetricsandCacheMetricsKeyfollowing theuser.rspattern.CacheMetricsKeyis frozen with__eq__/__hash__, soStats.cache_metricsconverts todict[CacheMetricsKey, CacheMetrics].IggyClient.get_statsreturns an awaitable resolving toStats; byte sizes are exposed as integer bytes and times as microseconds, matching the existing getters. Stubs were regenerated withcargo run --bin stub_gen(purely additive diff after ruff).tests/test_stats.pycreates 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
Ran against a locally built
iggy-serverfrom this branch:pytest tests/gives 323 passed (onlytest_tlserrors 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