Skip to content

Commit

Permalink
Reduce metrics cardinality
Browse files Browse the repository at this point in the history
  • Loading branch information
swift1337 committed Jan 16, 2025
1 parent 3cebe8e commit 8705c9a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions zetaclient/chains/bitcoin/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ func (c *Client) sendCommand(ctx context.Context, cmd any) (json.RawMessage, err
return nil, errors.Wrap(err, "unable to marshal cmd")
}

// ps: we can add retry logic if needed

req, err := c.newRequest(ctx, reqBody)
if err != nil {
return nil, errors.Wrapf(err, "unable to create http request for %q", method)
Expand Down Expand Up @@ -187,7 +185,7 @@ func (c *Client) recordMetrics(method string, start time.Time, out rawResponse,
}

metrics.RPCClientCounter.WithLabelValues(status, c.clientName, method).Inc()
metrics.RPCClientDuration.WithLabelValues(status, c.clientName, method).Observe(dur)
metrics.RPCClientDuration.WithLabelValues(c.clientName).Observe(dur)
}

func (c *Client) marshalCmd(cmd any) (string, []byte, error) {
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ var (
Help: "Histogram of rpc client calls durations in seconds",
Buckets: []float64{0.05, 0.1, 0.2, 0.3, 0.5, 1, 1.5, 2, 3, 5, 7.5, 10, 15}, // 50ms to 15s
},
[]string{"status", "client", "method"},
[]string{"client"},
)
)

Expand Down

0 comments on commit 8705c9a

Please sign in to comment.