| 1 | --- |
| 2 | title: Parser |
| 3 | weight: 6 |
| 4 | --- |
| 5 | |
| 6 | The Python client supports parsing the Prometheus text format. |
| 7 | This is intended for advanced use cases where you have servers |
| 8 | exposing Prometheus metrics and need to get them into some other |
| 9 | system. |
| 10 | |
| 11 | ```python |
| 12 | from prometheus_client.parser import text_string_to_metric_families |
| 13 | for family in text_string_to_metric_families(u"my_gauge 1.0\n"): |
| 14 | for sample in family.samples: |
| 15 | print("Name: {0} Labels: {1} Value: {2}".format(*sample)) |
| 16 | ``` |