From ac417f75cb79460fd1f683bf95768a46b130e1e7 Mon Sep 17 00:00:00 2001 From: Marcin Wolny Date: Fri, 16 Feb 2024 10:09:49 +0100 Subject: [PATCH] Clean up obsolete metric --- internal/proxy/healthchecker.go | 9 --------- internal/proxy/manager.go | 23 ----------------------- 2 files changed, 32 deletions(-) diff --git a/internal/proxy/healthchecker.go b/internal/proxy/healthchecker.go index d7718fd..d329fee 100644 --- a/internal/proxy/healthchecker.go +++ b/internal/proxy/healthchecker.go @@ -15,7 +15,6 @@ import ( const ( MetricBlockNumber int = iota MetricGasLimit - MetricResponseTime ) const ( @@ -87,7 +86,6 @@ type RPCHealthchecker struct { mu sync.RWMutex // metrics - metricResponseTime *prometheus.HistogramVec metricRPCProviderBlockNumber *prometheus.GaugeVec metricRPCProviderGasLimit *prometheus.GaugeVec } @@ -121,8 +119,6 @@ func (h *RPCHealthchecker) SetMetric(i int, metric interface{}) { h.metricRPCProviderBlockNumber = metric.(*prometheus.GaugeVec) case MetricGasLimit: h.metricRPCProviderGasLimit = metric.(*prometheus.GaugeVec) - case MetricResponseTime: - h.metricResponseTime = metric.(*prometheus.HistogramVec) default: zap.L().Warn("invalid metric type, ignoring.") } @@ -133,16 +129,11 @@ func (h *RPCHealthchecker) checkBlockNumber(ctx context.Context) (uint64, error) // used to evaluate a single RPC node against others var blockNumber hexutil.Uint64 - start := time.Now() err := h.client.CallContext(ctx, &blockNumber, "eth_blockNumber") if err != nil { zap.L().Warn("error fetching the block number", zap.Error(err), zap.String("name", h.config.Name)) return 0, err } - duration := time.Since(start) - if h.metricResponseTime != nil { - h.metricResponseTime.WithLabelValues(h.config.Name, "eth_blockNumber").Observe(duration.Seconds()) - } if h.metricRPCProviderBlockNumber != nil { h.metricRPCProviderBlockNumber.WithLabelValues(h.config.Name).Set(float64(blockNumber)) } diff --git a/internal/proxy/manager.go b/internal/proxy/manager.go index b089558..51f0268 100644 --- a/internal/proxy/manager.go +++ b/internal/proxy/manager.go @@ -20,7 +20,6 @@ type HealthcheckManager struct { metricRPCProviderInfo *prometheus.GaugeVec metricRPCProviderStatus *prometheus.GaugeVec - metricResponseTime *prometheus.HistogramVec metricRPCProviderBlockNumber *prometheus.GaugeVec metricRPCProviderGasLimit *prometheus.GaugeVec } @@ -45,27 +44,6 @@ func NewHealthcheckManager(config HealthcheckManagerConfig) *HealthcheckManager "provider", "type", }), - metricResponseTime: promauto.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "zeroex_rpc_gateway_healthcheck_response_duration_seconds", - Help: "Histogram of response time for Gateway Healthchecker in seconds", - Buckets: []float64{ - .005, - .01, - .025, - .05, - .1, - .25, - .5, - 1, - 2.5, - 5, - 10, - }, - }, []string{ - "provider", - "method", - }), metricRPCProviderBlockNumber: promauto.NewGaugeVec( prometheus.GaugeOpts{ Name: "zeroex_rpc_gateway_provider_block_number", @@ -95,7 +73,6 @@ func NewHealthcheckManager(config HealthcheckManagerConfig) *HealthcheckManager healthchecker.SetMetric(MetricBlockNumber, healthcheckManager.metricRPCProviderBlockNumber) healthchecker.SetMetric(MetricGasLimit, healthcheckManager.metricRPCProviderGasLimit) - healthchecker.SetMetric(MetricResponseTime, healthcheckManager.metricResponseTime) if err != nil { panic(err)