feat(telemetry): add portable local telemetry plane
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
CREATE EXTENSION IF NOT EXISTS timescaledb;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS contour_telemetry_samples (
|
||||
observed_at TIMESTAMPTZ NOT NULL,
|
||||
ingested_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
contour_id TEXT NOT NULL,
|
||||
agent_id TEXT NOT NULL,
|
||||
node_id TEXT NOT NULL,
|
||||
kind TEXT NOT NULL,
|
||||
measurement TEXT NOT NULL,
|
||||
series_key TEXT NOT NULL DEFAULT '',
|
||||
source_schema TEXT NOT NULL,
|
||||
source_topic TEXT NOT NULL,
|
||||
lab_id TEXT,
|
||||
run_id TEXT,
|
||||
request_id TEXT,
|
||||
frame_index BIGINT,
|
||||
payload JSONB NOT NULL,
|
||||
PRIMARY KEY (
|
||||
observed_at,
|
||||
contour_id,
|
||||
agent_id,
|
||||
kind,
|
||||
measurement,
|
||||
series_key
|
||||
)
|
||||
);
|
||||
|
||||
SELECT create_hypertable(
|
||||
'contour_telemetry_samples',
|
||||
by_range('observed_at'),
|
||||
if_not_exists => TRUE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS contour_telemetry_latest_idx
|
||||
ON contour_telemetry_samples (
|
||||
contour_id,
|
||||
agent_id,
|
||||
kind,
|
||||
measurement,
|
||||
series_key,
|
||||
observed_at DESC
|
||||
);
|
||||
Reference in New Issue
Block a user