Skip to content

Commit

Permalink
Create audit failure metrics unconditionally (#3937)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanjfellows authored and jefferai committed Feb 7, 2018
1 parent b020d31 commit 4a0d3f6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions vault/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,11 @@ func (a *AuditBroker) LogRequest(ctx context.Context, auth *logical.Auth, req *l
}

ret = retErr.ErrorOrNil()

failure := float32(0.0)
if ret != nil {
metrics.IncrCounter([]string{"audit", "log_request_failure"}, 1.0)
failure = 1.0
}
metrics.IncrCounter([]string{"audit", "log_request_failure"}, failure)
}()

// All logged requests must have an identifier
Expand Down Expand Up @@ -588,9 +589,11 @@ func (a *AuditBroker) LogResponse(ctx context.Context, auth *logical.Auth, req *

ret = retErr.ErrorOrNil()

failure := float32(0.0)
if ret != nil {
metrics.IncrCounter([]string{"audit", "log_response_failure"}, 1.0)
failure = 1.0
}
metrics.IncrCounter([]string{"audit", "log_response_failure"}, failure)
}()

headers := req.Headers
Expand Down

0 comments on commit 4a0d3f6

Please sign in to comment.