Skip to content

Conversation

@eric-weaver
Copy link
Contributor

What does this PR do?

This fixes a regression introduced in #21347 where collect_wal_metrics was accidentally changed to true by default for all Postgres versions. This is safe and desired for Postgres 10+ as we pull wal stats metrics from pg_ls_waldir. On Postgres 9.6 and below this function view doesn't exist and we need to pull wal stats directly from the local filesystem. This method doesn't work on older Postgres instances unless the agent is running on the same physical host and has the appropriate permissions to read the directory.

Motivation

We're now fixing collect_wal_metrics to work as it did previously where it defaults to unset and it will be implied enabled on Postgres 10+ unless explicitly disabled and implied disabled on Postgres 9.6 and below unless explicitly enabled. This is to provide a more stable out of the box experience.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

# ERROR: Function pg_stat_get_wal_receiver() is currently not supported in Aurora
if self.is_aurora is False:
queries.append(QUERY_PG_STAT_WAL_RECEIVER)
if self._config.collect_wal_metrics is not False:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditional sanity check

>>> # Default test
>>> None is not False
True
>>> # Explicitly enabled
>>> True is not False
True
>>> # Explicitly disabled
>>> False is not False
False

self.metadata_samples.run_job_loop(tags)
if self._config.collect_wal_metrics:
# collect wal metrics for pg < 10, disabled by enabled
if self._config.collect_wal_metrics is True:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditional sanity check

>>> # Deafult test
>>> None is True
False
>>> # Explicitly enabled
>>> True is True
True
>>> # Explicitly disabled
>>> False is True
False

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.34%. Comparing base (7fd6437) to head (a6e0033).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-datadog-prod-us1
Copy link
Contributor

datadog-datadog-prod-us1 bot commented Jan 20, 2026

⚠️ Tests

Fix all issues with Cursor

⚠️ Warnings

❄️ 3 New flaky tests detected

test_common_metrics[aurora] from test_pg_integration.py (Datadog) (Fix with Cursor)
[Errno 7] Argument list too long: 'docker'
test_replication_slot_information from test_replication_slot.py (Datadog) (Fix with Cursor)
[Errno 7] Argument list too long: 'docker'
test_parse_rds_eol_version from test_version_utils.py (Datadog) (Fix with Cursor)
[Errno 7] Argument list too long: 'docker'

ℹ️ Info

🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: a6e0033 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants