| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…text Add a note to the collect() protocol section explaining that yield is idiomatic (generator iterates lazily, no state between scrapes) and a preamble to the API Reference section clarifying that code snippets belong inside a collect() method. Follows up on review feedback in prometheus#1169. Signed-off-by: k1chik <kkukdia@gmail.com>
The single block with two yield statements looked like one collect() yielding both patterns. Split into labelled prose + code pairs to make clear they are alternatives, not sequential yields. Signed-off-by: k1chik <kkukdia@gmail.com>
There was a problem hiding this comment.
Thanks!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
@csmarchbanks
Three issues raised in review of #1169 by @calestyo:
The API Reference code examples used bare yield statements without
any surrounding def collect(self): context, making it unclear what
they belonged to. Added a preamble to the API Reference section
pointing back to the top-level example.
The InfoMetricFamily example had two yield statements in a single
block, which looked like one collect() yielding both patterns rather
than two alternatives. Split into separate labelled blocks.
The collect() protocol section gave no explanation for why generators
are used. Added a note explaining that yield is idiomatic (lazy
iteration, no intermediate list) and that each scrape gets a fresh call
with no state carried over.