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

add google-cloud-sqlcommenter #4663

Merged
merged 1 commit into from
May 6, 2024
Merged

Conversation

groovecoder
Copy link
Member

@groovecoder groovecoder commented May 3, 2024

This PR is for #MPP-3746.

How to test:

  1. pip install -r requirements.txt
  2. Be sure that your postgresql is logging to a directory and log file you can see (I made the changes in https://stackoverflow.com/q/722221 and restarted my postgresql server)
  3. python manage.py runserver
  4. Sign in at http://127.0.0.1:8000/
  5. Go to http://127.0.0.1:8000/api/v1/relayaddresses/?format=json
  6. Open your postgresql log file from step 2
    • You should see strings like this appended to the SQL SELECT statement logs: /*controller='relayaddress-list',framework='django%3A4.2.11',route='api/v1/relayaddresses/%24'*/

Checklist

  • l10n changes have been submitted to the l10n repository, if any.
  • I've added a unit test to test for potential regressions of this bug.
  • I've added or updated relevant docs in the docs/ directory.
  • All UI revisions follow the coding standards, and use Protocol tokens where applicable (see /frontend/src/styles/tokens.scss).
  • Commits in this PR are minimal and have descriptive commit messages.

@jwhitlock jwhitlock self-requested a review May 3, 2024 19:36
Copy link
Member

@jwhitlock jwhitlock left a comment

Choose a reason for hiding this comment

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

Thanks @groovecoder, looks good to me!

I used:

brew services stop postgresql@14
/opt/homebrew/opt/postgresql@14/bin/postgres -D /opt/homebrew/var/postgresql@14 -c log_statement=all

and got logs like:

2024-05-03 14:42:49.944 CDT [4928] LOG:  statement: SELECT "emails_domainaddress"."id", "emails_domainaddress"."user_id", "emails_domainaddress"."address", "emails_domainaddress"."enabled", "emails_domainaddress"."description", "emails_domainaddress"."domain", "emails_domainaddress"."created_at", "emails_domainaddress"."first_emailed_at", "emails_domainaddress"."last_modified_at", "emails_domainaddress"."last_used_at", "emails_domainaddress"."num_forwarded", "emails_domainaddress"."num_blocked", "emails_domainaddress"."num_level_one_trackers_blocked", "emails_domainaddress"."num_replied", "emails_domainaddress"."num_spam", "emails_domainaddress"."block_list_emails", "emails_domainaddress"."used_on" FROM "emails_domainaddress" WHERE "emails_domainaddress"."user_id" = 2 /*controller='profiles-list',framework='django%3A4.2.11',route='api/v1/profiles/%24'*/
2024-05-03 14:42:49.949 CDT [4928] LOG:  statement: SELECT COUNT(*) AS "__count" FROM "emails_relayaddress" WHERE "emails_relayaddress"."user_id" = 2 /*controller='profiles-list',framework='django%3A4.2.11',route='api/v1/profiles/%24'*/
2024-05-03 14:42:49.954 CDT [4928] LOG:  statement: SELECT COUNT(*) AS "__count" FROM "emails_domainaddress" WHERE "emails_domainaddress"."user_id" = 2 /*controller='profiles-list',framework='django%3A4.2.11',route='api/v1/profiles/%24'*/
2024-05-03 14:42:49.955 CDT [4928] LOG:  statement: SELECT "socialaccount_socialaccount"."id", "socialaccount_socialaccount"."user_id", "socialaccount_socialaccount"."provider", "socialaccount_socialaccount"."uid", "socialaccount_socialaccount"."last_login", "socialaccount_socialaccount"."date_joined", "socialaccount_socialaccount"."extra_data" FROM "socialaccount_socialaccount" WHERE "socialaccount_socialaccount"."user_id" = 2 /*controller='profiles-list',framework='django%3A4.2.11',route='api/v1/profiles/%24'*/
2024-05-03 14:42:49.956 CDT [4928] LOG:  statement: SELECT "socialaccount_socialaccount"."id", "socialaccount_socialaccount"."user_id", "socialaccount_socialaccount"."provider", "socialaccount_socialaccount"."uid", "socialaccount_socialaccount"."last_login", "socialaccount_socialaccount"."date_joined", "socialaccount_socialaccount"."extra_data" FROM "socialaccount_socialaccount" WHERE "socialaccount_socialaccount"."user_id" = 2 /*controller='profiles-list',framework='django%3A4.2.11',route='api/v1/profiles/%24'*/

@groovecoder groovecoder added this pull request to the merge queue May 6, 2024
Merged via the queue into main with commit 184fd1d May 6, 2024
28 checks passed
@groovecoder groovecoder deleted the add-google-cloud-sqlcommenter branch May 6, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants