Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of improve client RPC metrics consistency into release/1.17.x #19843

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changelog/19721.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:improvement
metrics: modify consul.client.rpc metric to exclude internal retries for consistency with consul.client.rpc.exceeded and consul.client.rpc.failed
```
```release-note:improvement
metrics: increment consul.client.rpc.failed if RPC fails because no servers are accessible
```
4 changes: 3 additions & 1 deletion agent/consul/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,17 @@ func (c *Client) RPC(ctx context.Context, method string, args interface{}, reply
firstCheck := time.Now()
retryCount := 0
previousJitter := time.Duration(0)

metrics.IncrCounter([]string{"client", "rpc"}, 1)
TRY:
retryCount++
manager, server := c.router.FindLANRoute()
if server == nil {
metrics.IncrCounter([]string{"client", "rpc", "failed"}, 1)
return structs.ErrNoServers
}

// Enforce the RPC limit.
metrics.IncrCounter([]string{"client", "rpc"}, 1)
if !c.rpcLimiter.Load().(*rate.Limiter).Allow() {
metrics.IncrCounter([]string{"client", "rpc", "exceeded"}, 1)
return structs.ErrRPCRateExceeded
Expand Down