Skip to content

Commit 363b74b

Browse files
committed
docs: split InfoMetricFamily example into two separate blocks
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>
1 parent f393961 commit 363b74b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

docs/content/collector/custom.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,15 @@ InfoMetricFamily(name, documentation, value=None, labels=None)
241241
| `value` | `Dict[str, str]` | Key-value label pairs that form the info payload. |
242242
| `timestamp` | `float` or `Timestamp` | Optional Unix timestamp. |
243243

244+
Single unlabelled info metric:
245+
244246
```python
245-
# single unlabelled info metric
246247
yield InfoMetricFamily('build', 'Build metadata', value={'version': '1.2.3', 'commit': 'abc123'})
248+
```
247249

248-
# labelled: one info metric per service
250+
Labelled — one info metric per service:
251+
252+
```python
249253
i = InfoMetricFamily('service_build', 'Per-service build info', labels=['service'])
250254
i.add_metric(['auth'], {'version': '2.0.1', 'commit': 'def456'})
251255
i.add_metric(['api'], {'version': '1.9.0', 'commit': 'ghi789'})

0 commit comments

Comments
 (0)