Skip to content

Commit

Permalink
remove rpcCtx conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Jan 6, 2023
1 parent d96bcdd commit 2afd240
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions nomad/rpc_rate_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ func (srv *Server) MeasureRPCRate(
endpoint, op string,
identity *structs.AuthenticatedIdentity, rpcCtx *RPCContext,
) {
if rpcCtx == nil {
return // we're the RPC caller and not the server
}
if !srv.config.ACLEnabled || identity == nil {
// If ACLs aren't enabled, we never have a sensible identity
metrics.IncrCounter([]string{"nomad", "rpc", endpoint, op}, 1)
} else {
metrics.IncrCounterWithLabels(
[]string{"nomad", "rpc", endpoint, op}, 1,
[]metrics.Label{{Name: "identity", Value: identity.String()}})
}
metrics.IncrCounterWithLabels(
[]string{"nomad", "rpc", endpoint, op}, 1,
[]metrics.Label{{Name: "identity", Value: identity.String()}})
}

0 comments on commit 2afd240

Please sign in to comment.