Skip to content

Conversation

@dalextorres
Copy link
Contributor

@dalextorres dalextorres commented Oct 20, 2025

What does this PR do?

This PR fixes the logic for the only_custom_queries configuration option. Previously this parameter wasn't doing what it said as we still ran the _collect_stats function and other dbm related functions even when the parameter was turned on.

I tested this by running a local version of the agent against the postgres local stack, having the primary with dbm:false and only_custom_queries:true. The results are as follows:

Our custom query is emitting correctly:
CleanShot 2025-10-20 at 16 08 44@2x

No metrics can be found in either of the default postgres integration dashboards. The database instance can't be found in the databases list as well.

One positive effect from this is that the custom queries metric emission is done at the end of the check with this new PR. Previously, custom queries would cause check crashes if they were malformed or really slow, by having them at the end we now make sure everything we collect is captured before trying to emit the custom queries' metrics.

CleanShot 2025-10-20 at 16 11 44@2x

Motivation

This functionality was not working as expected for a customer, leading us to finding the issue: Ticket

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

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.30%. Comparing base (46169ca) to head (8252b7b).
⚠️ Report is 14 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.

Copy link
Contributor

@eric-weaver eric-weaver left a comment

Choose a reason for hiding this comment

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

Looks good! One side effect of this change is it looks like we're now running custom queries last at the check loop. This is probably for the better until we can move custom queries into it's own out of band loop. It's not uncommon for broken or slow custom queries to cause checks to crash and miss capturing builtin metrics and events. So one thing we should note and be aware of for this change is additional data that might have been missed might start making it through on upgrade

@dalextorres dalextorres added this pull request to the merge queue Oct 21, 2025
Merged via the queue into master with commit a32934f Oct 21, 2025
71 checks passed
@dalextorres dalextorres deleted the alex.torres/fix-only-custom-queries-param branch October 21, 2025 22:12
sethsamuel pushed a commit that referenced this pull request Nov 18, 2025
* fix logic for only_custom_queries parameter

* fix custom queries test

* add changelog

* run ddev test format
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.

3 participants