Commit 38f409a
committed
Add option to set 'escaping' parameter
Due to its simplistic design, prom2json has always tolerated any
characters in metric and label names. (It does not validate anything,
just puts strings into JSON objects…)
However, a compliant scrape target will only serve unescaped UTF-8 in
names if asked to do so. This commit adds a CLI option to add the
'escaping=SCHEME' parameter in content negotiation.
We cannot set this option to 'allow-utf-8' by default without a major
release because users might depend on the default (underscore)
escaping.
I implemented this in a slightly clunky way to not change the library
API (although we use semver for the user API, not the library API here
– I still thought we can be nice at a relatively small price).
Signed-off-by: beorn7 <beorn@grafana.com>1 parent c075304 commit 38f409a
2 files changed
+29
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
47 | 56 | | |
48 | 57 | | |
49 | 58 | | |
| |||
88 | 97 | | |
89 | 98 | | |
90 | 99 | | |
91 | | - | |
92 | | - | |
| 100 | + | |
93 | 101 | | |
94 | 102 | | |
95 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| |||
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
180 | 191 | | |
181 | 192 | | |
182 | 193 | | |
183 | 194 | | |
184 | 195 | | |
185 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
186 | 201 | | |
187 | 202 | | |
188 | 203 | | |
| |||
0 commit comments