metrics
Schema: arbitrage
Description
The metrics
table in the arbitrage
schema is used to store various metrics related to our running arbitrage system. This table is useful for tracking and analyzing trends and patterns in trades, system performance, etc.
Columns
Name | Type | Description | Default |
---|---|---|---|
metric_time | timestamptz | The time the metric was recorded | None |
metric_namespace | text | The namespace of the metric (e.g. arbitrage/executor, arbitrage/dex-activity, etc.) | None |
metric_name | text | The name of the metric (e.g. runtime , quotedTokenOutAmount , etc.) | None |
val | numeric | The value of the metric | None |
dimensions | jsonb | Any associated dimensions for the metric | None |
context | jsonb | Any additional context for the metric | None |
Examples
Get the namespace/name of all metrics generated in the last 3 hours
select distinct metric_namespace, metric_name
from arbitrage.metrics m
where metric_time > now() - '3 hours'::interval
order by metric_namespace, metric_name;
Get the hourly-average runtime for all namespaces over the past 24 hours
select
time_bucket('1 hour'::interval, m.metric_time) time,
m.metric_namespace,
avg(m.val) as average_val
from arbitrage.metrics m
where m.metric_name = 'runtime'
and m.metric_time > now() - '24 hours'::interval
group by metric_namespace, time
order by time;