Closed illia-malachyn closed 2 months ago
The updates introduce a robust metrics collection system using Prometheus to monitor API errors and request durations in the Flow EVM Gateway project. This includes changes to incorporate a new Collector
interface, modifications in various API functions to utilize this collector, and configurations for running a Prometheus server. Additionally, the .gitignore
and Makefile
have been updated to handle the new metrics data directory.
File/Path | Change Summary |
---|---|
.gitignore |
Added metrics/data/ to the ignored directories list. |
Makefile |
Updated start-local target to remove metrics/data/ before running the main.go script. |
api/api.go |
Integrated metrics collection into various API functions using the new collector parameter. |
api/debug.go |
Modified error handling functions to use &metrics.NoopCollector{} parameter. |
bootstrap/bootstrap.go |
Added metricsServer and metricsCollector setup in the server start function. |
go.mod |
Added direct dependency on github.com/prometheus/client_golang v1.18.0 . |
metrics/collector.go |
Introduced Collector interface and DefaultCollector for tracking API errors and request durations using Prometheus. |
metrics/noop_collector.go |
Added NoopCollector struct with no-op methods for metrics collection. |
metrics/prometheus.yml |
Added configuration for Prometheus to scrape metrics from flow-evm-gateway . |
metrics/server.go |
Created Server struct to handle Prometheus metrics server setup and shutdown. |
In the realm of bytes, a rabbit hops, Tracking metrics, never stops. Prometheus watches, data flows, Errors caught, performance shows. With each request, a story told, In the logs, the truth unfolds. š°š
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Note that this one includes commits from https://github.com/onflow/flow-evm-gateway/pull/360. So, you want to review from this commit Add API request metric
will push this to #360 as it is small enough
This covers the following requirements:
Measure end-to-end request/response time by method call (track the time taken from the start of a request to the return of the response for each method call to understand relative performance and user experience using percentiles).
api_request_duration_seconds_bucket
api_request_duration_seconds_bucket{resolver="SendRawTransaction"}
API requests per time interval metric
rate(api_request_duration_seconds_count{resolver="SendRawTransaction"}[5m])
API calls by API endpoint (most used to least used calls)
sort_desc(sum by(resolver) (rate(api_request_duration_seconds_count{resolver="SendRawTransaction"}[5m])))
Summary by CodeRabbit
New Features
Chores
.gitignore
to excludemetrics/data/
directory.Makefile
to removemetrics/data/
directory before running scripts.