Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ccip-exec: lbtc histogram #1573

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

var (
usdcLatencyBuckets = []float64{
latencyBuckets = []float64{
float64(10 * time.Millisecond),
float64(25 * time.Millisecond),
float64(50 * time.Millisecond),
Expand All @@ -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"})
)

Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading