Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise postgresql.replication_delay to Function with Archive WAL-driv… #15925

Merged
merged 7 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion postgres/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

***Fixed***:

* Revise `postgresql.replication_delay` to function with archive WAL-driven replica ([#15925](https://github.com/DataDog/integrations-core/pull/15925))
* Prevent Postgres integration from collecting WAL metrics from Aurora instances that cannot be collected ([#15896](https://github.com/DataDog/integrations-core/pull/15896))
* Set lower log level for relations metrics truncated ([#15903](https://github.com/DataDog/integrations-core/pull/15903))

Expand Down Expand Up @@ -47,7 +48,6 @@

***Fixed***:

* Revise postgresql.replication_delay to Function with Archive WAL-driven PostgreSQL Replica ([#15629](https://github.com/DataDog/integrations-core/pull/15629))
* Pass timeout when connection pool closes ([#15724](https://github.com/DataDog/integrations-core/pull/15724))

## 14.2.1 / 2023-08-29
Expand Down
7 changes: 4 additions & 3 deletions postgres/datadog_checks/postgres/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@ def payload_pg_version(version):
}

q1 = (
'CASE WHEN pg_last_wal_receive_lsn() IS NULL OR '
'pg_last_wal_receive_lsn() = pg_last_wal_replay_lsn() THEN 0 ELSE GREATEST '
'(0, EXTRACT (EPOCH FROM now() - pg_last_xact_replay_timestamp())) END'
'CASE WHEN exists(SELECT * FROM pg_stat_wal_receiver) '
'AND (pg_last_wal_receive_lsn() IS NULL '
'OR pg_last_wal_receive_lsn() = pg_last_wal_replay_lsn()) THEN 0 '
'ELSE GREATEST(0, EXTRACT (EPOCH FROM now() - pg_last_xact_replay_timestamp())) END'
)
q2 = 'abs(pg_wal_lsn_diff(pg_last_wal_receive_lsn(), pg_last_wal_replay_lsn()))'
REPLICATION_METRICS_10 = {
Expand Down
Loading