Skip to content

Commit 1b666d3

Browse files
committed
DF-23700 metrics: harmonize rpc metrics
Harmonize labels and values across latency and error/success metrics. rpcDomain, not rpcUrl callName, not rpcCallName Caller passes hostname, not full URL but keeping sanitization for future-proofing.
1 parent 446045d commit 1b666d3

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

metrics/client.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type RPCClientMetrics interface {
4040
// RecordRequest records latency for an RPC call (observed in nanoseconds for Prometheus and Beholder).
4141
// Failures use success="false"; derive error rate from rpc_call_latency_count{success="false"} (or equivalent).
4242
// rpcURL is sanitized before export (userinfo and query removed; path hashed).
43-
RecordRequest(ctx context.Context, rpcURL string, isSendOnly bool, callName string, latency time.Duration, err error)
43+
RecordRequest(ctx context.Context, rpcDomain string, isSendOnly bool, callName string, latency time.Duration, err error)
4444
}
4545

4646
var _ RPCClientMetrics = (*rpcClientMetrics)(nil)
@@ -74,11 +74,11 @@ func NewRPCClientMetrics(cfg RPCClientMetricsConfig) (RPCClientMetrics, error) {
7474
}, nil
7575
}
7676

77-
func (m *rpcClientMetrics) RecordRequest(ctx context.Context, rpcURL string, isSendOnly bool, callName string, latency time.Duration, err error) {
77+
func (m *rpcClientMetrics) RecordRequest(ctx context.Context, rpcDomain string, isSendOnly bool, callName string, latency time.Duration, err error) {
7878
successStr := strconv.FormatBool(err != nil)
7979
sendStr := strconv.FormatBool(isSendOnly)
8080
latencyNs := float64(latency)
81-
safeRPCURL := SanitizeRPCURL(rpcURL)
81+
safeRPCURL := SanitizeRPCURL(rpcDomain)
8282

8383
RPCCallLatency.WithLabelValues(
8484
m.chainFamily, m.chainID, safeRPCURL, sendStr, successStr, callName,
@@ -87,10 +87,10 @@ func (m *rpcClientMetrics) RecordRequest(ctx context.Context, rpcURL string, isS
8787
m.latencyHis.Record(ctx, latencyNs/float64(time.Millisecond), metric.WithAttributes(
8888
attribute.String("chainFamily", m.chainFamily),
8989
attribute.String("chainID", m.chainID),
90-
attribute.String("rpcUrl", safeRPCURL),
90+
attribute.String("rpcDomain", safeRPCURL),
9191
attribute.String("isSendOnly", sendStr),
9292
attribute.String("success", successStr),
93-
attribute.String("rpcCallName", callName),
93+
attribute.String("callName", callName),
9494
))
9595
}
9696

0 commit comments

Comments
 (0)