app/vmselect: typo fix when stripping url path prefixes

This commit is contained in:
Aliaksandr Valialkin 2021-02-04 19:28:44 +02:00
parent 83d3e582ab
commit 4d43ab0875

View file

@ -119,7 +119,7 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool {
} }
if strings.HasPrefix(path, "/api/v1/label/") { if strings.HasPrefix(path, "/api/v1/label/") {
s := r.URL.Path[len("/api/v1/label/"):] s := path[len("/api/v1/label/"):]
if strings.HasSuffix(s, "/values") { if strings.HasSuffix(s, "/values") {
labelValuesRequests.Inc() labelValuesRequests.Inc()
labelName := s[:len(s)-len("/values")] labelName := s[:len(s)-len("/values")]
@ -133,7 +133,7 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool {
} }
} }
if strings.HasPrefix(path, "/tags/") && !isGraphiteTagsPath(path) { if strings.HasPrefix(path, "/tags/") && !isGraphiteTagsPath(path) {
tagName := r.URL.Path[len("/tags/"):] tagName := path[len("/tags/"):]
graphiteTagValuesRequests.Inc() graphiteTagValuesRequests.Inc()
if err := graphite.TagValuesHandler(startTime, tagName, w, r); err != nil { if err := graphite.TagValuesHandler(startTime, tagName, w, r); err != nil {
graphiteTagValuesErrors.Inc() graphiteTagValuesErrors.Inc()