Commit e7be0ad
committed
fix: prometheus metrics annotations
## Why
Previously, the `_node/_local/_prometheus`
endpoints would return invalid annotations
for certain metrics. For example:
```
# TYPE couchdb_database_reads_total counterof times a document was read from a database
couchdb_database_reads_total 2208
```
In general this doesn't matter too much - prometheus
will infer the type from the metric name - but
some clients will respect it and generate
errors/warnings if the annotations are incorrect.
## What
This removes the carriage returns from the
prometheus output. These were added as an incorrect
fix to spurious newlines in the output but
caused this bug with the annotations.
The actual bug causing the additional newlines is
that the result of `type_def/3` was additionally
wrapped in a list.
This commit removes the re-wrapping. removes the
carriage return and adds a test for the
output. This changes the output of `to_prom` slightly
because the first element of the result is no longer1 parent f06c3ec commit e7be0ad
2 files changed
Lines changed: 23 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
224 | 241 | | |
225 | 242 | | |
226 | 243 | | |
| |||
288 | 305 | | |
289 | 306 | | |
290 | 307 | | |
291 | | - | |
| 308 | + | |
292 | 309 | | |
293 | 310 | | |
294 | 311 | | |
295 | | - | |
| 312 | + | |
296 | 313 | | |
297 | 314 | | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| |||
0 commit comments