8000 Document parser · rmohr/client_python@60c0d7e · GitHub
[go: up one dir, main page]

Skip to content

Commit 60c0d7e

Browse files
committed
Document parser
1 parent 2c9c27c commit 60c0d7e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,3 +317,19 @@ REGISTRY.register(CustomCollector())
317317

318318
`SummaryMetricFamily` and `HistogramMetricFamily` work similarly.
319319

320+
321+
## Parser
322+
323+
The Python client supports parsing the Promeheus text format.
324+
This is intended for advanced use cases where you have servers
325+
exposing Prometheus metrics and need to get them into some other
326+
system.
327+
328+
```
329+
from prometheus_client.parser import text_string_to_metric_families
330+
for family in text_string_to_metric_families("my_gauge 1.0\n"):
331+
for sample in family.samples:
332+
print("Name: {0} Labels: {1} Value: {2}".format(*sample))
333+
```
334+
335+

0 commit comments

Comments
 (0)
0