metrics: Improve template metrics duration formatting

Fixes #15027
This commit is contained in:
Shiwang Bisht
2026-08-24 15:06:58 +05:30
committed by GitHub
parent 723579ff54
commit a25af7facf
3 changed files with 37 additions and 4 deletions
+2 -2
View File
@@ -170,8 +170,8 @@ D1
got := buf.String()
// Get rid of all the durations, they are never the same.
durationRe := regexp.MustCompile(`\b[\.\d]*(ms|ns|µs|s)\b`)
// Get rid of all the durations, including the space and unit, they are never the same.
durationRe := regexp.MustCompile(`\b[\.\d]*\s*(ms|ns|µs|s)\b`)
normalize := func(s string) string {
s = durationRe.ReplaceAllString(s, "")