Commit d43925d
committed
plugins(stats_over_http): Add Prometheus v2 output with metric labels
The current Prometheus output in stats_over_http dumps flattened metric
names (e.g., proxy.process.http.200_responses), which makes it difficult
to aggregate data in Grafana or Prometheus. This adds a new "v2" output
format that parses these names into proper labels like
status="200" or method="GET".
The new format can be accessed via /_stats/prometheus_v2 or by passing
an Accept header with version=2.0.0.
To keep this efficient, the parsing uses swoc::TextView for a zero-
allocation approach. It recognizes common ATS patterns such as status
codes, HTTP methods, cache results, and thread/volume indices. I've
also added deduplication for the HELP and TYPE metadata lines, so that
metrics sharing the same base name (but different labels) are grouped
correctly in the output.
Includes compile-time unit tests (static_assert) to verify the parsing
logic and updated AuTests for the new endpoint.1 parent dea3657 commit d43925d
File tree
5 files changed
+487
-28
lines changed- doc/admin-guide/plugins
- plugins/stats_over_http
- tests/gold_tests/pluginTest/stats_over_http
- gold
5 files changed
+487
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
| 113 | + | |
111 | 114 | | |
112 | 115 | | |
113 | 116 | | |
114 | | - | |
115 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
119 | | - | |
| 123 | + | |
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
123 | 131 | | |
124 | 132 | | |
125 | 133 | | |
| |||
129 | 137 | | |
130 | 138 | | |
131 | 139 | | |
132 | | - | |
133 | | - | |
134 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
135 | 145 | | |
136 | 146 | | |
137 | 147 | | |
| |||
0 commit comments