Rust

clickhouse

Module

The 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):

TableHolds
_events (MergeTree)raw events with their dimension columns, projections per dimension on an hourly bucket
_events_daily (SummingMergeTree) and _events_daily_mvevents 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;
Rust
pub struct ClickHouse<A: utopia_client::Adapter = Http>

Usage metrics in ClickHouse, through a utopia-client transport.

Also implements Debug.
use utopia_usage::adapter::clickhouse::Config;
Rust
pub struct Config

How to reach ClickHouse and lay out the tables.

use utopia_usage::adapter::clickhouse::RouteEntry;
Rust
pub struct RouteEntry

One routing decision.

use utopia_usage::adapter::clickhouse::Stats;
Rust
pub struct Stats

Request statistics.

clickhouse::read

Own page

Reads: query parsing and validation, rows, aggregates, counts, sums, time series, the daily table, and purges.

clickhouse::route

Own page

Routing of event totals: raw events, the daily rollup, or both.

clickhouse::samples

Own page

Canonical samples: the immutable ledger, watermarks and evidence reads.

clickhouse::setup

Own page

Health, the schema (setup()), and the daily rollup's backfill.