Skip metric increment during existence check (#12763)

* Skip metric increment during existence check

Signed-off-by: Vinayak Kadam <kadamvinayak03@gmail.com>

* Adding changelog.txt

Signed-off-by: Vinayak Kadam <kadamvinayak03@gmail.com>

* Updated changelog text

Signed-off-by: Vinayak Kadam <kadamvinayak03@gmail.com>
This commit is contained in:
Vinayak 2022-05-05 22:52:19 +05:30 committed by GitHub
parent 1a21b00bf1
commit 988468a67b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

3
changelog/12763.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note: bug
core: Fix double counting for "route" metrics
```

View File

@ -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
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