Skip to content

Commit

Permalink
Add prom metrics [2]
Browse files Browse the repository at this point in the history
  • Loading branch information
swift1337 committed Jan 14, 2025
1 parent c6a8a68 commit 2375ca9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion zetaclient/chains/bitcoin/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (c *Client) recordMetrics(method string, start time.Time, out rawResponse,
status = "failed"
}

Check warning on line 159 in zetaclient/chains/bitcoin/client/client.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/bitcoin/client/client.go#L153-L159

Added lines #L153 - L159 were not covered by tests

// "status", "client", "method"
metrics.RPCClientCounter.WithLabelValues(status, c.clientName, method).Inc()
metrics.RPCClientDuration.WithLabelValues(status, c.clientName, method).Observe(dur)

Check warning on line 162 in zetaclient/chains/bitcoin/client/client.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/chains/bitcoin/client/client.go#L161-L162

Added lines #L161 - L162 were not covered by tests
}

Expand Down
9 changes: 9 additions & 0 deletions zetaclient/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ var (
[]string{"status", "task_group", "task_name"},
)

RPCClientCounter = promauto.NewCounterVec(
prometheus.CounterOpts{
Namespace: ZetaClientNamespace,
Name: "rpc_client_calls_total",
Help: "Total number of rpc calls",
},
[]string{"status", "client", "method"},
)

RPCClientDuration = promauto.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: ZetaClientNamespace,
Expand Down

0 comments on commit 2375ca9

Please sign in to comment.