Add metrics to rate limiter

This commit is contained in:
Claudio Ortolina
2026-03-02 19:23:27 +00:00
parent c066585cbf
commit 6ef5f0a000
3 changed files with 66 additions and 0 deletions
+6
View File
@@ -56,6 +56,12 @@ defmodule Req.RateLimiter do
remaining = cooldown - elapsed
if remaining > 0 do
:telemetry.execute(
[:req, :rate_limiter, :throttle],
%{sleep_ms: remaining},
%{name: name}
)
Process.sleep(remaining)
end