AuroraMeter.Broadcaster (Aurora Meter v0.1.0)

View Source

Fans live counter values out over Phoenix.PubSub on an interval, decoupled from the (slower) database flush.

Each tick broadcasts the current value of every recently-changed counter on its tenant topic ("aurora_meter:tenant:" <> tenant_key) as {:aurora_meter, :usage, %{feature:, value:, period_start:}}.

Summary

Functions

Broadcasts changed counters now, returning :ok.

Returns a specification to start this module under a supervisor.

The PubSub topic for a tenant's usage updates.

Functions

broadcast_now()

@spec broadcast_now() :: :ok

Broadcasts changed counters now, returning :ok.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

topic(tenant_key)

@spec topic(String.t()) :: String.t()

The PubSub topic for a tenant's usage updates.