promscale
promscale copied to clipboard
Catch long running tasks in DB by exposing metrics from `pg_stat_activity`
We should add metrics from pg_stat_activity such that, this metric promscale_sql_database_pg_stat_activity{backend_type="", query="", pid="", application_name=""}
will have 2 value, 0
or 1
. If an entry exists in the database, then 1
, otherwise 0
.
This metric will be very useful in debugging since it catches long-running services in the database (the graph will show a long line steady at 1 for several hours/days), which could potentially be the cause of CPU load.
We may have to do some changes in the database metrics engine to add support for this.