mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
feat(proxy): record tunnel stability metrics
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
ALTER TABLE public.proxy_node_events
|
||||
ADD COLUMN IF NOT EXISTS event_metadata json;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.proxy_node_metrics_1m (
|
||||
node_id character varying(36) NOT NULL,
|
||||
bucket_start_unix_secs bigint NOT NULL,
|
||||
samples bigint DEFAULT 0 NOT NULL,
|
||||
uptime_samples bigint DEFAULT 0 NOT NULL,
|
||||
active_connections_sum bigint DEFAULT 0 NOT NULL,
|
||||
active_connections_max bigint DEFAULT 0 NOT NULL,
|
||||
heartbeat_rtt_ms_sum bigint DEFAULT 0 NOT NULL,
|
||||
heartbeat_rtt_ms_max bigint DEFAULT 0 NOT NULL,
|
||||
connect_errors_delta bigint DEFAULT 0 NOT NULL,
|
||||
disconnects_delta bigint DEFAULT 0 NOT NULL,
|
||||
error_events_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_in_bytes_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_out_bytes_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_in_frames_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_out_frames_delta bigint DEFAULT 0 NOT NULL,
|
||||
PRIMARY KEY (node_id, bucket_start_unix_secs),
|
||||
CONSTRAINT proxy_node_metrics_1m_node_id_fkey
|
||||
FOREIGN KEY (node_id) REFERENCES public.proxy_nodes(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.proxy_node_metrics_1h (
|
||||
node_id character varying(36) NOT NULL,
|
||||
bucket_start_unix_secs bigint NOT NULL,
|
||||
samples bigint DEFAULT 0 NOT NULL,
|
||||
uptime_samples bigint DEFAULT 0 NOT NULL,
|
||||
active_connections_sum bigint DEFAULT 0 NOT NULL,
|
||||
active_connections_max bigint DEFAULT 0 NOT NULL,
|
||||
heartbeat_rtt_ms_sum bigint DEFAULT 0 NOT NULL,
|
||||
heartbeat_rtt_ms_max bigint DEFAULT 0 NOT NULL,
|
||||
connect_errors_delta bigint DEFAULT 0 NOT NULL,
|
||||
disconnects_delta bigint DEFAULT 0 NOT NULL,
|
||||
error_events_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_in_bytes_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_out_bytes_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_in_frames_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_out_frames_delta bigint DEFAULT 0 NOT NULL,
|
||||
PRIMARY KEY (node_id, bucket_start_unix_secs),
|
||||
CONSTRAINT proxy_node_metrics_1h_node_id_fkey
|
||||
FOREIGN KEY (node_id) REFERENCES public.proxy_nodes(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_proxy_node_metrics_1m_bucket_start
|
||||
ON public.proxy_node_metrics_1m (bucket_start_unix_secs);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_proxy_node_metrics_1h_bucket_start
|
||||
ON public.proxy_node_metrics_1h (bucket_start_unix_secs);
|
||||
@@ -8,3 +8,4 @@
|
||||
110_redeem_codes.sql
|
||||
120_stats_rollups.sql
|
||||
130_stats_cost_savings.sql
|
||||
140_proxy_node_metrics.sql
|
||||
|
||||
@@ -39,7 +39,48 @@ CREATE TABLE IF NOT EXISTS proxy_node_events (
|
||||
`node_id` VARCHAR(64) NOT NULL,
|
||||
`event_type` VARCHAR(64) NOT NULL,
|
||||
`detail` VARCHAR(500),
|
||||
`event_metadata` JSON,
|
||||
`created_at` BIGINT NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS proxy_node_metrics_1m (
|
||||
`node_id` VARCHAR(64) NOT NULL,
|
||||
`bucket_start_unix_secs` BIGINT NOT NULL,
|
||||
`samples` BIGINT NOT NULL DEFAULT 0,
|
||||
`uptime_samples` BIGINT NOT NULL DEFAULT 0,
|
||||
`active_connections_sum` BIGINT NOT NULL DEFAULT 0,
|
||||
`active_connections_max` BIGINT NOT NULL DEFAULT 0,
|
||||
`heartbeat_rtt_ms_sum` BIGINT NOT NULL DEFAULT 0,
|
||||
`heartbeat_rtt_ms_max` BIGINT NOT NULL DEFAULT 0,
|
||||
`connect_errors_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`disconnects_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`error_events_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`ws_in_bytes_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`ws_out_bytes_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`ws_in_frames_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`ws_out_frames_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`node_id`, `bucket_start_unix_secs`),
|
||||
KEY idx_proxy_node_metrics_1m_bucket_start (`bucket_start_unix_secs`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS proxy_node_metrics_1h (
|
||||
`node_id` VARCHAR(64) NOT NULL,
|
||||
`bucket_start_unix_secs` BIGINT NOT NULL,
|
||||
`samples` BIGINT NOT NULL DEFAULT 0,
|
||||
`uptime_samples` BIGINT NOT NULL DEFAULT 0,
|
||||
`active_connections_sum` BIGINT NOT NULL DEFAULT 0,
|
||||
`active_connections_max` BIGINT NOT NULL DEFAULT 0,
|
||||
`heartbeat_rtt_ms_sum` BIGINT NOT NULL DEFAULT 0,
|
||||
`heartbeat_rtt_ms_max` BIGINT NOT NULL DEFAULT 0,
|
||||
`connect_errors_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`disconnects_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`error_events_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`ws_in_bytes_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`ws_out_bytes_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`ws_in_frames_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
`ws_out_frames_delta` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`node_id`, `bucket_start_unix_secs`),
|
||||
KEY idx_proxy_node_metrics_1h_bucket_start (`bucket_start_unix_secs`)
|
||||
);
|
||||
|
||||
|
||||
@@ -40,8 +40,51 @@ CREATE TABLE IF NOT EXISTS public.proxy_node_events (
|
||||
node_id character varying(64) NOT NULL,
|
||||
event_type character varying(64) NOT NULL,
|
||||
detail character varying(500),
|
||||
event_metadata jsonb,
|
||||
created_at bigint NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY public.proxy_node_events ADD CONSTRAINT proxy_node_events_pkey PRIMARY KEY (id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.proxy_node_metrics_1m (
|
||||
node_id character varying(64) NOT NULL,
|
||||
bucket_start_unix_secs bigint NOT NULL,
|
||||
samples bigint DEFAULT 0 NOT NULL,
|
||||
uptime_samples bigint DEFAULT 0 NOT NULL,
|
||||
active_connections_sum bigint DEFAULT 0 NOT NULL,
|
||||
active_connections_max bigint DEFAULT 0 NOT NULL,
|
||||
heartbeat_rtt_ms_sum bigint DEFAULT 0 NOT NULL,
|
||||
heartbeat_rtt_ms_max bigint DEFAULT 0 NOT NULL,
|
||||
connect_errors_delta bigint DEFAULT 0 NOT NULL,
|
||||
disconnects_delta bigint DEFAULT 0 NOT NULL,
|
||||
error_events_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_in_bytes_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_out_bytes_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_in_frames_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_out_frames_delta bigint DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY public.proxy_node_metrics_1m ADD CONSTRAINT proxy_node_metrics_1m_pkey PRIMARY KEY (node_id, bucket_start_unix_secs);
|
||||
CREATE INDEX IF NOT EXISTS idx_proxy_node_metrics_1m_bucket_start ON public.proxy_node_metrics_1m USING btree (bucket_start_unix_secs);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.proxy_node_metrics_1h (
|
||||
node_id character varying(64) NOT NULL,
|
||||
bucket_start_unix_secs bigint NOT NULL,
|
||||
samples bigint DEFAULT 0 NOT NULL,
|
||||
uptime_samples bigint DEFAULT 0 NOT NULL,
|
||||
active_connections_sum bigint DEFAULT 0 NOT NULL,
|
||||
active_connections_max bigint DEFAULT 0 NOT NULL,
|
||||
heartbeat_rtt_ms_sum bigint DEFAULT 0 NOT NULL,
|
||||
heartbeat_rtt_ms_max bigint DEFAULT 0 NOT NULL,
|
||||
connect_errors_delta bigint DEFAULT 0 NOT NULL,
|
||||
disconnects_delta bigint DEFAULT 0 NOT NULL,
|
||||
error_events_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_in_bytes_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_out_bytes_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_in_frames_delta bigint DEFAULT 0 NOT NULL,
|
||||
ws_out_frames_delta bigint DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY public.proxy_node_metrics_1h ADD CONSTRAINT proxy_node_metrics_1h_pkey PRIMARY KEY (node_id, bucket_start_unix_secs);
|
||||
CREATE INDEX IF NOT EXISTS idx_proxy_node_metrics_1h_bucket_start ON public.proxy_node_metrics_1h USING btree (bucket_start_unix_secs);
|
||||
|
||||
|
||||
@@ -38,6 +38,47 @@ CREATE TABLE IF NOT EXISTS proxy_node_events (
|
||||
node_id TEXT NOT NULL,
|
||||
event_type TEXT NOT NULL,
|
||||
detail TEXT,
|
||||
event_metadata TEXT,
|
||||
created_at INTEGER NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS proxy_node_metrics_1m (
|
||||
node_id TEXT NOT NULL,
|
||||
bucket_start_unix_secs INTEGER NOT NULL,
|
||||
samples INTEGER NOT NULL DEFAULT 0,
|
||||
uptime_samples INTEGER NOT NULL DEFAULT 0,
|
||||
active_connections_sum INTEGER NOT NULL DEFAULT 0,
|
||||
active_connections_max INTEGER NOT NULL DEFAULT 0,
|
||||
heartbeat_rtt_ms_sum INTEGER NOT NULL DEFAULT 0,
|
||||
heartbeat_rtt_ms_max INTEGER NOT NULL DEFAULT 0,
|
||||
connect_errors_delta INTEGER NOT NULL DEFAULT 0,
|
||||
disconnects_delta INTEGER NOT NULL DEFAULT 0,
|
||||
error_events_delta INTEGER NOT NULL DEFAULT 0,
|
||||
ws_in_bytes_delta INTEGER NOT NULL DEFAULT 0,
|
||||
ws_out_bytes_delta INTEGER NOT NULL DEFAULT 0,
|
||||
ws_in_frames_delta INTEGER NOT NULL DEFAULT 0,
|
||||
ws_out_frames_delta INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (node_id, bucket_start_unix_secs)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_proxy_node_metrics_1m_bucket_start ON proxy_node_metrics_1m (bucket_start_unix_secs);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS proxy_node_metrics_1h (
|
||||
node_id TEXT NOT NULL,
|
||||
bucket_start_unix_secs INTEGER NOT NULL,
|
||||
samples INTEGER NOT NULL DEFAULT 0,
|
||||
uptime_samples INTEGER NOT NULL DEFAULT 0,
|
||||
active_connections_sum INTEGER NOT NULL DEFAULT 0,
|
||||
active_connections_max INTEGER NOT NULL DEFAULT 0,
|
||||
heartbeat_rtt_ms_sum INTEGER NOT NULL DEFAULT 0,
|
||||
heartbeat_rtt_ms_max INTEGER NOT NULL DEFAULT 0,
|
||||
connect_errors_delta INTEGER NOT NULL DEFAULT 0,
|
||||
disconnects_delta INTEGER NOT NULL DEFAULT 0,
|
||||
error_events_delta INTEGER NOT NULL DEFAULT 0,
|
||||
ws_in_bytes_delta INTEGER NOT NULL DEFAULT 0,
|
||||
ws_out_bytes_delta INTEGER NOT NULL DEFAULT 0,
|
||||
ws_in_frames_delta INTEGER NOT NULL DEFAULT 0,
|
||||
ws_out_frames_delta INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (node_id, bucket_start_unix_secs)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_proxy_node_metrics_1h_bucket_start ON proxy_node_metrics_1h (bucket_start_unix_secs);
|
||||
|
||||
|
||||
@@ -177,6 +177,177 @@ type = "text"
|
||||
length = 500
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_node_events.columns]]
|
||||
name = "event_metadata"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_node_events.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[table.proxy_node_metrics_1m]
|
||||
domain = "proxy_nodes"
|
||||
order = 30
|
||||
primary_key = ["node_id", "bucket_start_unix_secs"]
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "node_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "bucket_start_unix_secs"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "samples"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "uptime_samples"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "active_connections_sum"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "active_connections_max"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "heartbeat_rtt_ms_sum"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "heartbeat_rtt_ms_max"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "connect_errors_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "disconnects_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "error_events_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "ws_in_bytes_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "ws_out_bytes_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "ws_in_frames_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.columns]]
|
||||
name = "ws_out_frames_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1m.indexes]]
|
||||
name = "idx_proxy_node_metrics_1m_bucket_start"
|
||||
columns = ["bucket_start_unix_secs"]
|
||||
|
||||
[table.proxy_node_metrics_1h]
|
||||
domain = "proxy_nodes"
|
||||
order = 40
|
||||
primary_key = ["node_id", "bucket_start_unix_secs"]
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "node_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "bucket_start_unix_secs"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "samples"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "uptime_samples"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "active_connections_sum"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "active_connections_max"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "heartbeat_rtt_ms_sum"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "heartbeat_rtt_ms_max"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "connect_errors_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "disconnects_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "error_events_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "ws_in_bytes_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "ws_out_bytes_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "ws_in_frames_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.columns]]
|
||||
name = "ws_out_frames_delta"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_node_metrics_1h.indexes]]
|
||||
name = "idx_proxy_node_metrics_1h_bucket_start"
|
||||
columns = ["bucket_start_unix_secs"]
|
||||
|
||||
Reference in New Issue
Block a user