tsweb/varz: flesh out munging of expvar keys into valid Prometheus metrics
From a problem we hit with how badger registers expvars; it broke trunkd's exported metrics. Updates tailscale/corp#1297 Change-Id: I42e1552e25f734c6f521b6e993d57a82849464b2 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
b104688e04
commit
4992aca6ec
@@ -43,6 +43,24 @@ func TestVarzHandler(t *testing.T) {
|
||||
new(expvar.Int),
|
||||
"# TYPE foo_bar counter\nfoo_bar 0\n",
|
||||
},
|
||||
{
|
||||
"slash_in_metric_name",
|
||||
"counter_foo/bar",
|
||||
new(expvar.Int),
|
||||
"# TYPE foo_bar counter\nfoo_bar 0\n",
|
||||
},
|
||||
{
|
||||
"metric_name_start_digit",
|
||||
"0abc",
|
||||
new(expvar.Int),
|
||||
"# TYPE _0abc counter\n_0abc 0\n",
|
||||
},
|
||||
{
|
||||
"metric_name_have_bogus_bytes",
|
||||
"abc\x10defügh",
|
||||
new(expvar.Int),
|
||||
"# TYPE abcdefgh counter\nabcdefgh 0\n",
|
||||
},
|
||||
{
|
||||
"int_with_type_counter",
|
||||
"counter_foo",
|
||||
|
||||
Reference in New Issue
Block a user