Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Preliminary v15 support #489

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions pgwatch2/metrics/db_stats/15/metric.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
select /* pgwatch2_generated */
(extract(epoch from now()) * 1e9)::int8 as epoch_ns,
numbackends,
xact_commit,
xact_rollback,
blks_read,
blks_hit,
tup_returned,
tup_fetched,
tup_inserted,
tup_updated,
tup_deleted,
conflicts,
temp_files,
temp_bytes,
deadlocks,
blk_read_time,
blk_write_time,
extract(epoch from (now() - pg_postmaster_start_time()))::int8 as postmaster_uptime_s,
checksum_failures,
extract(epoch from (now() - checksum_last_failure))::int8 as checksum_last_failure_s,
case when pg_is_in_recovery() then 1 else 0 end as in_recovery_int,
system_identifier::text as tag_sys_id,
session_time::int8,
active_time::int8,
idle_in_transaction_time::int8,
sessions,
sessions_abandoned,
sessions_fatal,
sessions_killed
from
pg_stat_database, pg_control_system()
where
datname = current_database();
34 changes: 34 additions & 0 deletions pgwatch2/metrics/db_stats/15/metric_su.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
select /* pgwatch2_generated */
(extract(epoch from now()) * 1e9)::int8 as epoch_ns,
numbackends,
xact_commit,
xact_rollback,
blks_read,
blks_hit,
tup_returned,
tup_fetched,
tup_inserted,
tup_updated,
tup_deleted,
conflicts,
temp_files,
temp_bytes,
deadlocks,
blk_read_time,
blk_write_time,
extract(epoch from (now() - coalesce((pg_stat_file('postmaster.pid', true)).modification, pg_postmaster_start_time())))::int8 as postmaster_uptime_s,
checksum_failures,
extract(epoch from (now() - checksum_last_failure))::int8 as checksum_last_failure_s,
case when pg_is_in_recovery() then 1 else 0 end as in_recovery_int,
system_identifier::text as tag_sys_id,
session_time::int8,
active_time::int8,
idle_in_transaction_time::int8,
sessions,
sessions_abandoned,
sessions_fatal,
sessions_killed
from
pg_stat_database, pg_control_system()
where
datname = current_database();
1 change: 0 additions & 1 deletion pgwatch2/metrics/db_stats/column_attrs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
prometheus_gauge_columns:
- numbackends
- postmaster_uptime_s
- backup_duration_s
- checksum_last_failure_s
prometheus_ignored_columns:
7 changes: 7 additions & 0 deletions pgwatch2/metrics/subscription_stats/15/metric.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
select /* pgwatch2_generated */
(extract(epoch from now()) * 1e9)::int8 as epoch_ns,
subname::text as tag_subname,
apply_error_count,
sync_error_count
from
pg_stat_subscription_stats;
93 changes: 93 additions & 0 deletions pgwatch2/sql/config_store/metric_definitions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,85 @@ $sql$,
'{"prometheus_gauge_columns": ["numbackends", "postmaster_uptime_s", "backup_duration_s", "checksum_last_failure_s"]}'
);

insert into pgwatch2.metric(m_name, m_pg_version_from, m_sql, m_sql_su, m_column_attrs)
values (
'db_stats',
15,
$sql$
select
(extract(epoch from now()) * 1e9)::int8 as epoch_ns,
numbackends,
xact_commit,
xact_rollback,
blks_read,
blks_hit,
tup_returned,
tup_fetched,
tup_inserted,
tup_updated,
tup_deleted,
conflicts,
temp_files,
temp_bytes,
deadlocks,
blk_read_time,
blk_write_time,
extract(epoch from (now() - pg_postmaster_start_time()))::int8 as postmaster_uptime_s,
checksum_failures,
extract(epoch from (now() - checksum_last_failure))::int8 as checksum_last_failure_s,
case when pg_is_in_recovery() then 1 else 0 end as in_recovery_int,
system_identifier::text as tag_sys_id,
session_time::int8,
active_time::int8,
idle_in_transaction_time::int8,
sessions,
sessions_abandoned,
sessions_fatal,
sessions_killed
from
pg_stat_database, pg_control_system()
where
datname = current_database();
$sql$,
$sql$
select
(extract(epoch from now()) * 1e9)::int8 as epoch_ns,
numbackends,
xact_commit,
xact_rollback,
blks_read,
blks_hit,
tup_returned,
tup_fetched,
tup_inserted,
tup_updated,
tup_deleted,
conflicts,
temp_files,
temp_bytes,
deadlocks,
blk_read_time,
blk_write_time,
extract(epoch from (now() - coalesce((pg_stat_file('postmaster.pid', true)).modification, pg_postmaster_start_time())))::int8 as postmaster_uptime_s,
checksum_failures,
extract(epoch from (now() - checksum_last_failure))::int8 as checksum_last_failure_s,
case when pg_is_in_recovery() then 1 else 0 end as in_recovery_int,
system_identifier::text as tag_sys_id,
session_time::int8,
active_time::int8,
idle_in_transaction_time::int8,
sessions,
sessions_abandoned,
sessions_fatal,
sessions_killed
from
pg_stat_database, pg_control_system()
where
datname = current_database();
$sql$,
'{"prometheus_gauge_columns": ["numbackends", "postmaster_uptime_s", "checksum_last_failure_s"]}'
);

insert into pgwatch2.metric(m_name, m_pg_version_from, m_sql, m_column_attrs)
values (
'db_stats_aurora',
Expand Down Expand Up @@ -7397,6 +7476,20 @@ $sql$
$sql$
);

insert into pgwatch2.metric(m_name, m_pg_version_from, m_sql)
values (
'subscription_stats',
15,
$sql$
select /* pgwatch2_generated */
(extract(epoch from now()) * 1e9)::int8 as epoch_ns,
subname::text as tag_subname,
apply_error_count,
sync_error_count
from
pg_stat_subscription_stats;
$sql$
);

/* Metric attributes */
-- truncate pgwatch2.metric_attribute;
Expand Down