From c26f5dfca9700fb7bcf0ad82041f2d9349efc37d Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Tue, 24 Sep 2024 11:41:28 +0800 Subject: [PATCH] fix: rpc request duration in seconds (#338) --- chainio/clients/eth/instrumented_client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chainio/clients/eth/instrumented_client.go b/chainio/clients/eth/instrumented_client.go index 1e90a8c1..0e69347a 100644 --- a/chainio/clients/eth/instrumented_client.go +++ b/chainio/clients/eth/instrumented_client.go @@ -376,7 +376,7 @@ func (iec *InstrumentedClient) TransactionByHash( if err != nil { return nil, false, err } - rpcRequestDuration := time.Since(start) + rpcRequestDuration := time.Since(start).Seconds() // we only observe the duration of successful calls (even though this is not well defined in the spec) iec.rpcCallsCollector.ObserveRPCRequestDurationSeconds( float64(rpcRequestDuration), @@ -455,7 +455,7 @@ func instrumentFunction[T any]( if err != nil { return value, err } - rpcRequestDuration := time.Since(start) + rpcRequestDuration := time.Since(start).Seconds() // we only observe the duration of successful calls (even though this is not well defined in the spec) iec.rpcCallsCollector.ObserveRPCRequestDurationSeconds( float64(rpcRequestDuration),