Limen.Stats (limen v0.2.1)

Copy Markdown View Source

Lock-free, node-local counters for dashboards and health checks.

Each instance has a single :counters array, created when it starts. Updating a counter is one :counters.add/3 call; reading them all is a snapshot that callers can diff over time to compute rates.

Summary

Functions

Increments counter name of an instance by one.

Returns the current value of every counter of an instance.

Types

name()

@type name() ::
  :allow
  | :challenge
  | :throttle
  | :deny
  | :tarpit
  | :maze
  | :enforced
  | :pass
  | :challenge_issued
  | :challenge_solved
  | :challenge_failed
  | :ban_added
  | :trap_hit
  | :maze_served
  | :maze_refused
  | :saturated

Functions

incr(instance, name)

@spec incr(Limen.Instance.t(), name()) :: :ok

Increments counter name of an instance by one.

snapshot(instance)

@spec snapshot(atom() | Limen.Instance.t()) :: %{
  required(name()) => non_neg_integer()
}

Returns the current value of every counter of an instance.