Skip to content

Commit 31a0cb0

Browse files
authored
DF-23700 harmonize rpc client metrics (#465)
pass the rpc domain to RPCClientBase, not the url bump cl-framework (brings better labels and sanitization)
1 parent ddc68a5 commit 31a0cb0

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ require (
3131
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20251022073203-7d8ae8cf67c1
3232
github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20260423135514-5b1a7565a99c
3333
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260423135514-5b1a7565a99c
34-
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260423135514-5b1a7565a99c
34+
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260508154216-3ed6f623098f
3535
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260505202410-b350dca113b4
3636
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260326111235-8c09d1a4491f
3737
github.com/smartcontractkit/chainlink-protos/svr v1.2.0

go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/rpc_client.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,12 @@ func NewRPCClient(
180180
lggr.Error("RPC client is configured with only WebSocket URL. If this CL Node serves external requests, it must also have an HTTP URL configured. Otherwise, there is a serious DDoS risk.")
181181
}
182182

183-
var rpcURL string
184-
if wsuri != nil {
185-
rpcURL = wsuri.String()
186-
} else if httpuri != nil {
187-
rpcURL = httpuri.String()
188-
}
189183
isSendOnly := tier == multinode.Secondary
190184
var rpcBaseMetrics frameworkmetrics.RPCClientMetrics
191185
if r.beholderMetrics != nil {
192186
rpcBaseMetrics = r.beholderMetrics.rpcClientMetrics
193187
}
194-
r.RPCClientBase = multinode.NewRPCClientBase[*evmtypes.Head](cfg, QueryTimeout, lggr, r.latestBlock, r.latestFinalizedBlock, rpcURL, isSendOnly, rpcBaseMetrics)
188+
r.RPCClientBase = multinode.NewRPCClientBase[*evmtypes.Head](cfg, QueryTimeout, lggr, r.latestBlock, r.latestFinalizedBlock, r.getRPCDomain(), isSendOnly, rpcBaseMetrics)
195189
return r
196190
}
197191

@@ -341,7 +335,11 @@ func (r *RPCClient) getRPCDomain() string {
341335
if http != nil {
342336
return http.uri.Host
343337
}
344-
return r.ws.Load().uri.Host
338+
ws := r.ws.Load()
339+
if ws != nil {
340+
return ws.uri.Host
341+
}
342+
return ""
345343
}
346344

347345
func (r *RPCClient) isChainType(chainType chaintype.ChainType) bool {

0 commit comments

Comments
 (0)