mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-26 17:21:01 +00:00
Add Benchmarks for escapeMetricName
Signed-off-by: Brian Akins <brian@akins.org>
This commit is contained in:
parent
e6bdf13407
commit
7f70979120
1 changed files with 21 additions and 0 deletions
|
@ -413,3 +413,24 @@ func getTelemetryCounterValue(counter prometheus.Counter) float64 {
|
|||
}
|
||||
return metric.Counter.GetValue()
|
||||
}
|
||||
|
||||
func BenchmarkEscapeMetricName(b *testing.B) {
|
||||
scenarios := []string{
|
||||
"clean",
|
||||
"0starts_with_digit",
|
||||
"with_underscore",
|
||||
"with.dot",
|
||||
"with😱emoji",
|
||||
"with.*.multiple",
|
||||
"test.web-server.foo.bar",
|
||||
"",
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
b.Run(s, func(b *testing.B) {
|
||||
for n := 0; n < b.N; n++ {
|
||||
escapeMetricName(s)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue