Skip to main content

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

NameTypeDescriptionDefault
metric_timetimestamptzThe time the metric was recordedNone
metric_namespacetextThe namespace of the metric (e.g. arbitrage/executor, arbitrage/dex-activity, etc.)None
metric_nametextThe name of the metric (e.g. runtime, quotedTokenOutAmount, etc.)None
valnumericThe value of the metricNone
dimensionsjsonbAny associated dimensions for the metricNone
contextjsonbAny additional context for the metricNone

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;