Skip to content

Commit 6b24faa

Browse files
authored
[!] remove obsolete db_stats_aurora metric (#930)
* [!] deprecate `db_stats_aurora` metric The `db_stats_aurora` metric was created as a workaround for early AWS Aurora PostgreSQL limitations that prevented using certain PostgreSQL functions like pg_backup_start_time() and complex subqueries for invalid index detection. Modern Aurora PostgreSQL versions (13+) now support virtually all standard PostgreSQL administration functions, making this Aurora-specific variant unnecessary. Users can simply use the standard `db_stats` metric instead, which provides the same functionality plus additional features like backup duration tracking and invalid index monitoring. This removal reduces maintenance overhead and eliminates confusing * [*] remove `aurora` preset * [*] update docs
1 parent d38d666 commit 6b24faa

File tree

4 files changed

+20
-86
lines changed

4 files changed

+20
-86
lines changed

docs/howto/using_managed_services.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,58 +27,58 @@ such a use case.
2727
pgwatch has been tested to work with the following managed database
2828
services:
2929

30-
# Google Cloud SQL for PostgreSQL
30+
## Google Cloud SQL for PostgreSQL
3131

32-
- No Python / OS helpers possible. OS metrics can be integrated in
32+
- No Python / OS helpers possible. OS metrics can be integrated in
3333
Grafana though using the
3434
[Stackdriver](https://grafana.com/docs/grafana/latest/datasources/google-cloud-monitoring/)
3535
data source.
36-
- `pg_monitor` system role available.
37-
- pgwatch default preset name: `gce`.
38-
- Documentation: <https://cloud.google.com/sql/docs/postgres>
36+
- `pg_monitor` system role available.
37+
- pgwatch default preset name: `gce`.
38+
- Documentation: <https://cloud.google.com/sql/docs/postgres>
3939

4040
To get most out pgwatch on GCE you need some additional clicks in the
4141
GUI / Cloud Console "Flags" section to enable some common PostgreSQL
4242
monitoring parameters like `track_io_timing` and `track_functions`.
4343

44-
# Amazon RDS for PostgreSQL
44+
## Amazon RDS for PostgreSQL
4545

46-
- No Python / OS helpers possible. OS metrics can be integrated in
46+
- No Python / OS helpers possible. OS metrics can be integrated in
4747
Grafana though using the
4848
[CloudWatch](https://grafana.com/docs/grafana/latest/datasources/cloudwatch/)
4949
data source
5050

51-
- `pg_monitor` system role available.
51+
- `pg_monitor` system role available.
5252

53-
- pgwatch default preset names: `rds`, `aurora`
53+
- pgwatch default preset names: `rds`
54+
55+
- Documentation:
5456

55-
- Documentation:
56-
5757
<https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html>
5858
<https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.AuroraPostgreSQL.html>
5959

6060
Note that the AWS Aurora PostgreSQL-compatible engine is missing some
6161
additional metrics compared to normal RDS.
6262

63-
# Azure Database for PostgreSQL
63+
## Azure Database for PostgreSQL
6464

65-
- No Python / OS helpers possible. OS metrics can be integrated in
65+
- No Python / OS helpers possible. OS metrics can be integrated in
6666
Grafana though using the [Azure
6767
Monitor](https://grafana.com/docs/grafana/latest/datasources/azuremonitor/)
6868
data source
69-
- `pg_monitor` system role available.
70-
- pgwatch default preset name: `azure`
71-
- Documentation: <https://docs.microsoft.com/en-us/azure/postgresql/>
69+
- `pg_monitor` system role available.
70+
- pgwatch default preset name: `azure`
71+
- Documentation: <https://docs.microsoft.com/en-us/azure/postgresql/>
7272

7373
Surprisingly on Azure some file access functions are whitelisted, thus
7474
one can for example use the `wal_size` metrics.
7575

7676
!!! Note
7777
By default Azure has **pg_stat_statements** not fully activated by
78-
default, so you need to enable it manually or via the API. Documentation
79-
link [here](https://docs.microsoft.com/en-us/azure/postgresql/howto-optimize-query-stats-collection).
78+
default, so you need to enable it manually or via the API.
79+
Documentation: <https://docs.microsoft.com/en-us/azure/postgresql/howto-optimize-query-stats-collection>
8080

81-
# Aiven for PostgreSQL
81+
## Aiven for PostgreSQL
8282

8383
The [Aiven developer
8484
documentation](https://aiven.io/docs/products/postgresql/howto/monitor-with-pgwatch2)

docs/reference/advanced_features.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,5 @@ plain removed. Thus, to reduce server log errors and save time on
141141
experimenting there are following presets available:
142142

143143
- **aws** - for standard AWS RDS managed PostgreSQL databases
144-
- **aurora** - for AWS Aurora managed PostgreSQL service
145144
- **azure** - for Azure Database for PostgreSQL managed databases
146145
- **gce** - for Google Cloud SQL for PostgreSQL managed databases

internal/metrics/metrics.yaml

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -714,45 +714,6 @@ metrics:
714714
- checksum_last_failure_s
715715
- parallel_workers_to_launch
716716
- parallel_workers_launched
717-
db_stats_aurora:
718-
description: >
719-
Retrieves key statistics from the PostgreSQL `pg_stat_database` view for Amazon Aurora PostgreSQL, providing insights into the current database's performance.
720-
It returns the number of backends, transaction commits and rollbacks, buffer reads and hits, tuple statistics, conflicts, temporary files and bytes,
721-
deadlocks, block read and write times, postmaster uptime, recovery status, system identifier, and invalid indexes.
722-
This metric helps administrators monitor database activity and performance in an Aurora PostgreSQL environment.
723-
sqls:
724-
11: |-
725-
select /* pgwatch_generated */
726-
(extract(epoch from now()) * 1e9)::int8 as epoch_ns,
727-
numbackends,
728-
xact_commit,
729-
xact_rollback,
730-
blks_read,
731-
blks_hit,
732-
tup_returned,
733-
tup_fetched,
734-
tup_inserted,
735-
tup_updated,
736-
tup_deleted,
737-
conflicts,
738-
temp_files,
739-
temp_bytes,
740-
deadlocks,
741-
blk_read_time,
742-
blk_write_time,
743-
extract(epoch from (now() - pg_postmaster_start_time()))::int8 as postmaster_uptime_s,
744-
case when pg_is_in_recovery() then 1 else 0 end as in_recovery_int,
745-
system_identifier::text as tag_sys_id
746-
from
747-
pg_stat_database, pg_control_system()
748-
where
749-
datname = current_database()
750-
gauges:
751-
- numbackends
752-
- postmaster_uptime_s
753-
- backup_duration_s
754-
- checksum_last_failure_s
755-
storage_name: db_stats
756717
index_hashes:
757718
description: >
758719
Retrieves the hash of index definitions in the PostgreSQL database, providing a way to track changes in index definitions over time.
@@ -4622,29 +4583,6 @@ presets:
46224583
table_stats: 300
46234584
wal: 60
46244585
wal_receiver: 120
4625-
aurora:
4626-
description: AWS Aurora doesn't expose all Postgres functions and there's no WAL
4627-
metrics:
4628-
archiver: 60
4629-
backends: 60
4630-
bgwriter: 60
4631-
checkpointer: 60
4632-
change_events: 300
4633-
db_size: 300
4634-
db_stats_aurora: 60
4635-
index_stats: 900
4636-
locks: 60
4637-
locks_mode: 60
4638-
replication: 120
4639-
replication_slots: 120
4640-
settings: 7200
4641-
sproc_stats: 180
4642-
stat_statements: 180
4643-
stat_statements_calls: 60
4644-
table_bloat_approx_summary_sql: 7200
4645-
table_io_stats: 600
4646-
table_stats: 300
4647-
wal_receiver: 120
46484586
azure:
46494587
description: similar to 'exhaustive' with stuff that's not accessible on Azure Database for PostgreSQL removed
46504588
metrics:
@@ -4943,7 +4881,6 @@ presets:
49434881
db_size: 30
49444882
db_size_approx: 30
49454883
db_stats: 30
4946-
db_stats_aurora: 30
49474884
index_hashes: 30
49484885
index_stats: 30
49494886
instance_up: 30

internal/reaper/metric.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ import (
1313
const (
1414
monitoredDbsDatastoreSyncIntervalSeconds = 600 // write actively monitored DBs listing to metrics store after so many seconds
1515
monitoredDbsDatastoreSyncMetricName = "configured_dbs" // FYI - for Postgres datastore there's also the admin.all_unique_dbnames table with all recent DB unique names with some metric data
16-
17-
dbSizeCachingInterval = 30 * time.Minute
18-
dbMetricJoinStr = "¤¤¤" // just some unlikely string for a DB name to avoid using maps of maps for DB+metric data
16+
dbMetricJoinStr = "¤¤¤" // just some unlikely string for a DB name to avoid using maps of maps for DB+metric data
1917

2018
)
2119

0 commit comments

Comments
 (0)