View Source LoggerSentry.RateLimiter behaviour (logger_sentry v0.8.0-rc4)

The top-level logic for rate limiting requests. Must be given a LoggerSentry.RateLimiter.Strategy to provide the details of the actual rate-limiting algorithm. The algorithm is specified by the application config. The following example sets a rate limit of 20 requests per minute using the token bucket algorithm.

import Config

config :logger_sentry, LoggerSentry.RateLimiter,
  rate_limiter_module: LoggerSentry.RateLimiter.TokenBucket,
  rate_limiter_options: [token_count: 20, interval_ms: 60_000]

If no strategy is configured, then defaults to the strategy LoggerSentry.RateLimiter.NoLimit. As implied by the name, this doesn't do any rate limiting.

You may provide your own rate limiters as long as they conform to the LoggerSentry.RateLimiter behaviour.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for GenServer.init/1.

Link to this section Types

Specs

opts() :: keyword()

Specs

strategy() :: LoggerSentry.RateLimiter.Strategy

Link to this section Callbacks

Specs

check(strategy()) :: {:ok | :skip, strategy()}

Specs

init(opts()) :: strategy()

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Callback implementation for GenServer.init/1.

Link to this function

send_rate_limited(rate_limiter \\ LoggerSentry.RateLimiter, output, options)

View Source