diff --git a/CHANGELOG.md b/CHANGELOG.md index d6c1f5a5..a6a73672 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## Unreleased +- Remove sqs_requests_total and sqs_request_duration_seconds metrics - Numia Pools APR fetcher, associated configs and wiring - Timeseries pool fees fetcher, associated configs and wiring diff --git a/Makefile b/Makefile index 59cab297..f7f5f1c4 100644 --- a/Makefile +++ b/Makefile @@ -184,10 +184,10 @@ test-prices-mainnet: # Run E2E tests in verbose mode (-s) -n 4 concurrent workers e2e-run-stage: - SQS_ENVIRONMENTS=stage pytest -s -n 4 --ignore=tests/test_syntheic_geo.py + SQS_ENVIRONMENTS=stage pytest -s -n 4 --ignore=tests/test_synthetic_geo.py e2e-run-local: - SQS_ENVIRONMENTS=local pytest -s -n 4 --ignore=tests/test_syntheic_geo.py + SQS_ENVIRONMENTS=local pytest -s -n 4 --ignore=tests/test_synthetic_geo.py #### E2E Python Setup @@ -209,7 +209,7 @@ e2e-update-requirements: # Set DATADOG_API_KEY in the environment datadog-agent-start: - export DATADOG_API_KEY=your-key; \ + export DATADOG_API_KEY=095a7a8c6007d0fa325c3e0b2ee898d4; \ docker run --cgroupns host \ --pid host \ -v /var/run/docker.sock:/var/run/docker.sock:ro \ diff --git a/middleware/middleware.go b/middleware/middleware.go index 4549ee84..5981d5e3 100644 --- a/middleware/middleware.go +++ b/middleware/middleware.go @@ -2,7 +2,6 @@ package middleware import ( "bytes" - "context" "fmt" "os" "sync" @@ -15,7 +14,6 @@ import ( "github.com/labstack/echo/v4" "github.com/osmosis-labs/sqs/domain" "github.com/osmosis-labs/sqs/log" - "github.com/prometheus/client_golang/prometheus" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" ) @@ -28,34 +26,11 @@ type GoMiddleware struct { } var ( - // total number of requests counter - requestsTotal = prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "sqs_requests_total", - Help: "Total number of requests.", - }, - []string{"method", "endpoint"}, - ) - - // request latency histogram - requestLatency = prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "sqs_request_duration_seconds", - Help: "Histogram of request latencies.", - Buckets: prometheus.DefBuckets, - }, - []string{"method", "endpoint"}, - ) // flight recorder recordFlightOnce sync.Once ) -func init() { - prometheus.MustRegister(requestsTotal) - prometheus.MustRegister(requestLatency) -} - // CORS will handle the CORS middleware func (m *GoMiddleware) CORS(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { @@ -90,28 +65,10 @@ func (m *GoMiddleware) InstrumentMiddleware(next echo.HandlerFunc) echo.HandlerF return func(c echo.Context) error { start := time.Now() - requestMethod := c.Request().Method - requestPath, err := domain.ParseURLPath(c) - if err != nil { - return err - } - - // Increment the request counter - requestsTotal.WithLabelValues(requestMethod, requestPath).Inc() - - // Insert the request path into the context - ctx := c.Request().Context() - ctx = context.WithValue(ctx, domain.RequestPathCtxKey, requestPath) - request := c.Request().WithContext(ctx) - c.SetRequest(request) - - err = next(c) + err := next(c) duration := time.Since(start) - // Observe the duration with the histogram - requestLatency.WithLabelValues(requestMethod, requestPath).Observe(duration.Seconds()) - // Record outliers to the flight recorder for further analysis if m.flightRecordConfig.Enabled && duration > time.Duration(m.flightRecordConfig.TraceThresholdMS)*time.Millisecond { recordFlightOnce.Do(func() {