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

Add metrics for RateLimiter #180

Closed
MartinquaXD opened this issue Apr 29, 2022 · 0 comments · Fixed by #183
Closed

Add metrics for RateLimiter #180

MartinquaXD opened this issue Apr 29, 2022 · 0 comments · Fixed by #183

Comments

@MartinquaXD
Copy link
Contributor

It would be nice to have some data about how often we need to back off from sending requests because we get rate limited.
I believe the RateLimiter is general pupose enough that we technically could use it for other APIs than Paraswap if the need arises so it would make sense to add labels to the metrics.

Metrics which would make sense:

#[derive(prometheus_metric_storage::MetricStorage, Clone, Debug)]
#[metric(subsystem = "rate_limiter")]
struct Metrics {
    /// Number of requests dropped while backing off.
    requests_dropped: prometheus::CounterVec,
    /// Number of responses indicating a rate limiting error.
    rate_limited_requests: prometheus::CounterVec,
    /// Number of successful requests.
    successful_requests: prometheus::CounterVec,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant