forked from mirrors/statsd_exporter
Add additional tests for #365
testing more edge cases. Signed-off-by: Matthias Rampke <matthias@prometheus.io>
This commit is contained in:
parent
0c4a66e6a1
commit
5793e05795
1 changed files with 40 additions and 2 deletions
|
@ -338,7 +338,7 @@ mappings:
|
|||
},
|
||||
},
|
||||
{
|
||||
testName: "Match metric segment starting with a number",
|
||||
testName: "Match metric segment with a number",
|
||||
config: `
|
||||
mappings:
|
||||
- match: test.99.myapp.*
|
||||
|
@ -357,7 +357,26 @@ mappings:
|
|||
},
|
||||
},
|
||||
{
|
||||
testName: "Match metric segment starting with a number #328 example",
|
||||
testName: "Match metric segment starting with a number",
|
||||
config: `
|
||||
mappings:
|
||||
- match: test.99test.myapp.*
|
||||
name: "name"
|
||||
labels:
|
||||
label: "${1}_foo"
|
||||
`,
|
||||
mappings: mappings{
|
||||
{
|
||||
statsdMetric: "test.99test.myapp.create",
|
||||
name: "name",
|
||||
labels: map[string]string{
|
||||
"label": "create_foo",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
testName: "Match metric segment with a number #328 example",
|
||||
config: `
|
||||
mappings:
|
||||
- match: kafka.server.FetcherStats.brokerHost.hostname.brokerPort.9092.clientId.ReplicaFetcherThread-0-1.BytesPerSec.1MinuteRate.gauge
|
||||
|
@ -370,6 +389,25 @@ mappings:
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
testName: "Single segment match",
|
||||
config: `
|
||||
mappings:
|
||||
- match: '*'
|
||||
name: single_segment
|
||||
labels:
|
||||
label: "${1}"
|
||||
`,
|
||||
mappings: mappings{
|
||||
{
|
||||
statsdMetric: "test",
|
||||
name: "single_segment",
|
||||
labels: map[string]string{
|
||||
"label": "test",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
testName: "Config with bad metric line",
|
||||
config: `---
|
||||
|
|
Loading…
Reference in a new issue