View Source Plausible.Site.GateKeeper (Plausible v0.0.1)

Thin wrapper around Plausible.RateLimit for gate keeping domain-specific events during the ingestion phase. When the site is allowed, gate keeping check returns :allow, otherwise a :deny tagged tuple is returned with one of the following policy markers:

  • :not_found (indicates site not found in cache)
  • :block (indicates disabled sites)
  • :throttle (indicates rate limiting)

Rate Limiting buckets are configured per site (externally via the CRM). See: Plausible.Site

To look up each site's configuration, the RateLimiter fetches a Site by domain using Plausible.Cache interface.

The module defines two policies outside the regular bucket inspection:

  • when the the site is not found in cache: not_found
  • when the underlying rate limiting mechanism returns an internal error: :allow

Summary

Types

@type policy() :: :allow | :not_found | :block | :throttle | :payment_required
@type t() :: {:allow, Plausible.Site.t()} | {:deny, policy()}

Functions

Link to this function

check(domain, opts \\ [])

View Source
@spec check(String.t(), Keyword.t()) :: t()
@spec key(String.t()) :: String.t()