From 6f124e67857fca65980d8989dddaa2bd0b4d558b Mon Sep 17 00:00:00 2001 From: Vinayak Kadam Date: Thu, 7 Oct 2021 12:47:19 +0530 Subject: [PATCH 1/3] Skip metric increment during existence check Signed-off-by: Vinayak Kadam --- vault/router.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vault/router.go b/vault/router.go index 6d61d7f0e4b2..f75ab52c789b 100644 --- a/vault/router.go +++ b/vault/router.go @@ -512,10 +512,12 @@ func (r *Router) routeCommon(ctx context.Context, req *logical.Request, existenc return logical.ErrorResponse(fmt.Sprintf("no handler for route '%s'", 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 From 25523930e828797cb5612a664cbac5f8ce5cec0e Mon Sep 17 00:00:00 2001 From: Vinayak Kadam Date: Thu, 7 Oct 2021 12:58:42 +0530 Subject: [PATCH 2/3] Adding changelog.txt Signed-off-by: Vinayak Kadam --- changelog/12763.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/12763.txt diff --git a/changelog/12763.txt b/changelog/12763.txt new file mode 100644 index 000000000000..181378f40eab --- /dev/null +++ b/changelog/12763.txt @@ -0,0 +1,3 @@ +```release-note: bug +COMPONENT: Telemetry data getting counted twice +``` \ No newline at end of file From 3e85f133e45c15b1de1a5702317cd3a120bc9526 Mon Sep 17 00:00:00 2001 From: Vinayak Kadam Date: Thu, 7 Oct 2021 17:45:43 +0530 Subject: [PATCH 3/3] Updated changelog text Signed-off-by: Vinayak Kadam --- changelog/12763.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/12763.txt b/changelog/12763.txt index 181378f40eab..0deac4cf5768 100644 --- a/changelog/12763.txt +++ b/changelog/12763.txt @@ -1,3 +1,3 @@ ```release-note: bug -COMPONENT: Telemetry data getting counted twice +core: Fix double counting for "route" metrics ``` \ No newline at end of file