View Source Plausible.Ingestion.Counters (Plausible v0.0.1)

This is instrumentation necessary for keeping track of per-domain internal metrics. Due to metric labels cardinality (domain x metric_name), these statistics are not suitable for prometheus/grafana exposure, hence an internal storage is used.

The module installs Counters.TelemetryHandler and periodically flushes the internal counter aggregates via Counters.Buffer interface.

The underlying database schema is running SummingMergeTree engine. To take advantage of automatic roll-ups it provides, upon dispatching the buffered records to Clickhouse this module transforms each event_timebucket aggregate into a 1-minute resolution.

Clickhouse connection is set to insert counters asynchronously every time a pool checkout is made. Those properties are reverted once the insert is done (or naturally, if the connection crashes).

Summary

Functions

@spec child_spec(Keyword.t()) :: Supervisor.child_spec() | :ignore
@spec enabled?() :: boolean()
@spec stop(pid()) :: :ok