feat(cluster_read): Batch Grafana queries via look-ahead in iterator#170
Merged
Merged
Conversation
057e83e to
2620f9a
Compare
…in iterator Group consecutive Grafana items in RequestedInfo.__next__() and fetch them in a single HTTP POST to the Graphite render API, up to --grafana-chunk-size targets per request (default 50). On batch failure, falls back to individual measure() calls with per-target @Retry. Uses POST body (data=) instead of query string to avoid URI length limits. Adds requests.Session() for TCP/TLS reuse. Measured: 28s -> 9s per node (3.2x speedup) on a 49-metric config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fe30860 to
44004d2
Compare
jhutar
approved these changes
Jun 8, 2026
Extract shared batch fixtures, RequestedInfo construction, and common assertions in test_cluster_read to satisfy jscpd without changing test coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
Switch cluster_read to absolute opl imports so pylint resolves the namespace package correctly in CI. Fixes: 5fbb2fc ("feat: I'm going to duplicate a ton of code here, I just need a quick way how to install core OPL without extra dependencies") Fixes: a44a56c ("chore: Sync main and core bits") Fixes: 7fb348c ("Rebase core/opl and cleanup") Co-authored-by: Cursor <cursoragent@cursor.com>
Factor repeated copy_from and simple Grafana test setup into helpers to reduce duplication and satisfy jscpd without changing test behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Reduce Grafana HTTP round-trips by batching consecutive targets into a single render request. Plugins opt in by implementing measure_many() and batch_size; the iterator groups and delegates automatically.
On batch failure, falls back to individual measure() calls with per-target @Retry, preserving the original resilience.
28s → 9s per node in production (49 requests → 1).