| 1 | --- |
| 2 | title: Graphite |
| 3 | weight: 1 |
| 4 | --- |
| 5 | |
| 6 | Metrics are pushed over TCP in the Graphite plaintext format. |
| 7 | |
| 8 | ```python |
| 9 | from prometheus_client.bridge.graphite import GraphiteBridge |
| 10 | |
| 11 | gb = GraphiteBridge(('graphite.your.org', 2003)) |
| 12 | # Push once. |
| 13 | gb.push() |
| 14 | # Push every 10 seconds in a daemon thread. |
| 15 | gb.start(10.0) |
| 16 | ``` |
| 17 | |
| 18 | Graphite [tags](https://grafana.com/blog/2018/01/11/graphite-1.1-teaching-an-old-dog-new-tricks/) are also supported. |
| 19 | |
| 20 | ```python |
| 21 | from prometheus_client.bridge.graphite import GraphiteBridge |
| 22 | |
| 23 | gb = GraphiteBridge(('graphite.your.org', 2003), tags=True) |
| 24 | c = Counter('my_requests_total', 'HTTP Failures', ['method', 'endpoint']) |
| 25 | c.labels('get', '/').inc() |
| 26 | gb.push() |
| 27 | ``` |