clickhouse
ModuleThe ClickHouse adapter: events, gauges, a daily rollup of events and canonical samples in ClickHouse tables, over its HTTP interface.
Tables (<namespace>_usage_*, or usage_* without a namespace):
| Table | Holds |
|---|---|
_events (MergeTree) | raw events with their dimension columns, projections per dimension on an hourly bucket |
_events_daily (SummingMergeTree) and _events_daily_mv | events summed per day, metric and resource |
_gauges (MergeTree) | gauge samples, windowed and latest-value projections |
_samples (MergeTree) | canonical samples |
Reads pick the cheapest source: closed days from the rollup, partial
hours and days from the raw table, grouped reads through projections the
server matches; ClickHouse::route_log records each decision.
Contents
4 submodules, and what the module defines itself.
use utopia_usage::adapter::clickhouse::ClickHouse;pub struct ClickHouse<A: utopia_client::Adapter = Http>Usage metrics in ClickHouse, through a utopia-client transport.
Debug.use utopia_usage::adapter::clickhouse::Config;pub struct ConfigHow to reach ClickHouse and lay out the tables.
use utopia_usage::adapter::clickhouse::RouteEntry;pub struct RouteEntryOne routing decision.
use utopia_usage::adapter::clickhouse::Stats;pub struct StatsRequest statistics.
clickhouse::read
Own pageReads: query parsing and validation, rows, aggregates, counts, sums, time series, the daily table, and purges.
clickhouse::route
Own pageRouting of event totals: raw events, the daily rollup, or both.
clickhouse::samples
Own pageCanonical samples: the immutable ledger, watermarks and evidence reads.
clickhouse::setup
Own pageHealth, the schema (setup()), and the daily rollup's backfill.