diff --git a/changelog/12763.txt b/changelog/12763.txt new file mode 100644 index 000000000..0deac4cf5 --- /dev/null +++ b/changelog/12763.txt @@ -0,0 +1,3 @@ +```release-note: bug +core: Fix double counting for "route" metrics +``` \ No newline at end of file diff --git a/vault/router.go b/vault/router.go index 1c11234eb..c0276f51d 100644 --- a/vault/router.go +++ b/vault/router.go @@ -535,10 +535,12 @@ func (r *Router) routeCommon(ctx context.Context, req *logical.Request, existenc return logical.ErrorResponse(fmt.Sprintf("no handler for route %q. route entry not found.", req.Path)), false, false, logical.ErrUnsupportedPath } req.Path = adjustedPath - defer metrics.MeasureSince([]string{ - "route", string(req.Operation), - strings.Replace(mount, "/", "-", -1), - }, time.Now()) + if !existenceCheck { + defer metrics.MeasureSince([]string{ + "route", string(req.Operation), + strings.Replace(mount, "/", "-", -1), + }, time.Now()) + } re := raw.(*routeEntry) // Grab a read lock on the route entry, this protects against the backend