diff --git a/core/services/ocr2/plugins/ccip/tokendata/http/observed_http_client.go b/core/services/ocr2/plugins/ccip/tokendata/http/observed_http_client.go index d8fb9b1c57..bac36abf7e 100644 --- a/core/services/ocr2/plugins/ccip/tokendata/http/observed_http_client.go +++ b/core/services/ocr2/plugins/ccip/tokendata/http/observed_http_client.go @@ -11,7 +11,7 @@ import ( ) var ( - usdcLatencyBuckets = []float64{ + latencyBuckets = []float64{ float64(10 * time.Millisecond), float64(25 * time.Millisecond), float64(50 * time.Millisecond), @@ -29,7 +29,12 @@ var ( usdcClientHistogram = promauto.NewHistogramVec(prometheus.HistogramOpts{ Name: "ccip_usdc_client_request_total", Help: "Latency of calls to the USDC client", - Buckets: usdcLatencyBuckets, + Buckets: latencyBuckets, + }, []string{"status", "success"}) + lbtcClientHistogram = promauto.NewHistogramVec(prometheus.HistogramOpts{ + Name: "ccip_lbtc_client_request_total", + Help: "Latency of calls to the LBTC client", + Buckets: latencyBuckets, }, []string{"status", "success"}) ) @@ -38,11 +43,16 @@ type ObservedIHttpClient struct { histogram *prometheus.HistogramVec } -// NewObservedIHttpClient Create a new ObservedIHttpClient with the USDC client metric. -func NewObservedIHttpClient(origin IHttpClient) *ObservedIHttpClient { +// NewObservedUsdcIHttpClient Create a new ObservedIHttpClient with the USDC client metric. +func NewObservedUsdcIHttpClient(origin IHttpClient) *ObservedIHttpClient { return NewObservedIHttpClientWithMetric(origin, usdcClientHistogram) } +// NewObservedLbtcIHttpClient Create a new ObservedIHttpClient with the LBTC client metric. +func NewObservedLbtcIHttpClient(origin IHttpClient) *ObservedIHttpClient { + return NewObservedIHttpClientWithMetric(origin, lbtcClientHistogram) +} + func NewObservedIHttpClientWithMetric(origin IHttpClient, histogram *prometheus.HistogramVec) *ObservedIHttpClient { return &ObservedIHttpClient{ IHttpClient: origin, diff --git a/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go b/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go index 94df0c76ad..86d3c71e62 100644 --- a/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go +++ b/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go @@ -135,7 +135,7 @@ func NewLBTCTokenDataReader( return &TokenDataReader{ lggr: lggr, - httpClient: http.NewObservedIHttpClient(&http.HttpClient{}), + httpClient: http.NewObservedLbtcIHttpClient(&http.HttpClient{}), attestationApi: lbtcAttestationApi, attestationApiTimeout: timeout, lbtcTokenAddress: lbtcTokenAddress, diff --git a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go index fe3a86d2af..89bb17e844 100644 --- a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go +++ b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go @@ -133,7 +133,7 @@ func NewUSDCTokenDataReader( return &TokenDataReader{ lggr: lggr, usdcReader: usdcReader, - httpClient: http.NewObservedIHttpClient(&http.HttpClient{}), + httpClient: http.NewObservedUsdcIHttpClient(&http.HttpClient{}), attestationApi: usdcAttestationApi, attestationApiTimeout: timeout, usdcTokenAddress: usdcTokenAddress,