Repository navigation
feat: add the Postgres query regression watch template for Cloud SQL - #18
Open
mayankpande88 wants to merge 1 commit into
Open
mayankpande88 wants to merge 1 commit into
mayankpande88 wants to merge 1 commit into
Conversation
Every three hours, finds queries that got slower and stayed slower against the same hours of the previous week, from Cloud SQL Query Insights, and opens one ticket per episode with the numbers, sampled plans, instance operations, optional table statistics from a Postgres connection, and an AI investigation of the cause. The detection is a fixed script with unit tests under scripts/; build.py embeds it in the template and CI checks the template is current.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a template that watches a Cloud SQL for PostgreSQL instance for queries that got slower and stayed slower, and opens one ticket per episode with the numbers and a likely cause.
What it does, every 3 hours
Look at
scripts/postgres_query_regression_watch/pqf.py: the rule (detect,check). The template embeds this file;build.py --checkin CI fails if the template is stale.if:conditions intemplate.yaml.in: everything after the script runs only when it reports something new.How to verify
new: falseand the later steps are skipped.Engineering detail
Local e2e: created the workflow from this template (manual trigger) on a development environment, and ran it against a Cloud SQL instance with "Check at" set to a known incident hour.
new: true, shared cause on 6 tables.After review fixes (plan errors no longer stop detection, empty thresholds use defaults, the database filter also scopes the shared-cause check), the script was re-run locally against the same instance and hour: same result.
Unit tests: 20 (
python3 -m unittest discover -s scripts/postgres_query_regression_watch -p 'test_*.py').