Skip to content

Commit

Permalink
Add mount_point label for rollback + route metrics
Browse files Browse the repository at this point in the history
Relates to hashicorp#9068
  • Loading branch information
Thor77 committed May 12, 2023
1 parent 3acbedd commit a3c8340
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion vault/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (m *RollbackManager) startOrLookupRollback(ctx context.Context, fullPath st

// attemptRollback invokes a RollbackOperation for the given path
func (m *RollbackManager) attemptRollback(ctx context.Context, fullPath string, rs *rollbackState, grabStatelock bool) (err error) {
defer metrics.MeasureSince([]string{"rollback", "attempt", strings.ReplaceAll(fullPath, "/", "-")}, time.Now())
defer metrics.MeasureSinceWithLabels([]string{"rollback", "attempt"}, time.Now(), []metrics.Label{{"mount_point", fullPath}})

defer func() {
rs.lastError = err
Expand Down
7 changes: 3 additions & 4 deletions vault/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,9 @@ func (r *Router) routeCommon(ctx context.Context, req *logical.Request, existenc
}
req.Path = adjustedPath
if !existenceCheck {
defer metrics.MeasureSince([]string{
"route", string(req.Operation),
strings.ReplaceAll(mount, "/", "-"),
}, time.Now())
defer metrics.MeasureSinceWithLabels([]string{
"route_requests",
}, time.Now(), []metrics.Label{{"operation", string(req.Operation)}, {"mount_point", mount}})
}
re := raw.(*routeEntry)

Expand Down

0 comments on commit a3c8340

Please sign in to comment.