+7
-2
search/metrics.go
+7
-2
search/metrics.go
···
4
4
"errors"
5
5
"net/http"
6
6
"strconv"
7
+
"strings"
7
8
"time"
8
9
9
10
"github.com/labstack/echo/v4"
···
111
112
responseSize := float64(c.Response().Size)
112
113
113
114
// Custom label for Typeahead search queries
114
-
isTypeahead := c.QueryParam("typeahead") == "true"
115
+
typeahead := false
116
+
if q := strings.TrimSpace(c.QueryParam("typeahead")); q == "true" || q == "1" || q == "y" {
117
+
typeahead = true
118
+
}
119
+
115
120
labels := []string{statusStr, method, path}
116
-
if isTypeahead {
121
+
if typeahead {
117
122
labels = append(labels, "typeahead")
118
123
} else {
119
124
labels = append(labels, "")