Resolve "SaaS Service Ping Metrics Failures causing null UMAU value"
What does this MR do and why?
Follow up to !73273 (merged) which scheduled async index creation
Every metric that is calculated based on data coming from database, service collection ServicePing data run actually 3 types of queries under the hood:
- Query to locate starting point, where is should begin counting metric from
- Query to locate finish point, where counting of metric should be stopped
- Query to calculate metric within boundaries of discovered at 1 and 2
Metric usage_activity_by_stage_monthly.manage.events
started to time out 1st query since planner used pkey index to look for starting point (see old query) After experimenting on postres.ai it was found out that index on created_at and id combined with dedicated start query should be able to vastly improve metric performance
Database
- Old timeouting min query: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/7064/commands/24990
- Index candidate: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/7145/commands/25312
- New min query: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/7145/commands/25315
- New max query https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/7145/commands/25316
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #343679 (closed)
Merge request reports
Activity
changed milestone to %14.5
assigned to @mikolaj_wawrzyniak
marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed
- A deleted user
added database databasereview pending labels
Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer backend Ethan Urie ( @eurie
) (UTC-5, 6 hours behind@mikolaj_wawrzyniak
)Tetiana Chupryna ( @brytannia
) (UTC+3, 2 hours ahead of@mikolaj_wawrzyniak
)database Diogo Frazão ( @dfrazao-gitlab
) (UTC+1, same timezone as@mikolaj_wawrzyniak
)Krasimir Angelov ( @krasio
) (UTC+13, 12 hours ahead of@mikolaj_wawrzyniak
)~migration No reviewer available No maintainer available To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
Dangeradded 27 commits
-
2b4dabcf...15d4fd73 - 25 commits from branch
master
- 75226960 - Add index on events using created_at and id
- 6cca9ad4 - Use custom range queries for events metric
-
2b4dabcf...15d4fd73 - 25 commits from branch
- A deleted user
removed backend product intelligence product intelligencereview pending labels
- A deleted user
mentioned in issue #343679 (closed)
mentioned in issue #344892
- Resolved by Tiger Watson
Hey @tigerwnz this MR is a followup to !73273 (merged) that sheduled async index migration, can you please let me know when it would be executed, so I can proceed with this MR to make sure that schemas of gitlab.com and self-managed will be consistent.
Side note: I wonder why db:check-schema job keep failing, maybe it is due the way how time constraint is handled and how plain date is converted to timestamp? If so it might be that it would be better to pass full timestamp instead of just a date as the constraint
added 432 commits
-
6cca9ad4...702b46ae - 430 commits from branch
master
- 74c5f36d - Add index on events using created_at and id
- 569696f9 - Use custom range queries for events metric
-
6cca9ad4...702b46ae - 430 commits from branch
added 72 commits
-
bad15b0a...08c95ed3 - 71 commits from branch
master
- 72aea9b7 - Add index on events using created_at and id
-
bad15b0a...08c95ed3 - 71 commits from branch
- Resolved by Mikołaj Wawrzyniak
- Resolved by Tiger Watson
@dfrazao-gitlab can I ask you for database review please
I would like to suggest@tigerwnz
as database maintainer since he was involved in !73273 (merged) to which this MR is a follow up
requested review from @eurie and @dfrazao-gitlab
- Resolved by Mikołaj Wawrzyniak
@eurie
, thanks for approving this merge request.This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.
For more info, please refer to the following links:
mentioned in issue gitlab-com/www-gitlab-com#5962 (closed)
Database migrations
Migrations included in this change have been executed on gitlab.com data for testing purposes. For details, please see the migration testing pipeline (limited access).
Migration Type Total runtime Result DB size change 20211103162025 - AddIndexOnEventsUsingBtreeCreatedAtId Post deploy 2.0 s +0.00 B Migration: 20211103162025 - AddIndexOnEventsUsingBtreeCreatedAtId
- Type: Post deploy
- Duration: 2.0 s
- Database size change: +0.00 B
Other migrations pending on GitLab.com
Migration Type Total runtime Result DB size change Clone Details
Clone ID Clone Created At Clone Data Timestamp Expected Removal Time database-testing-881843
2021-11-09 09:06:30 UTC 2021-11-09 07:59:55 UTC 2021-11-09 21:07:34 +0000 Artifacts
Brought to you by gitlab-org/database-team/gitlab-com-database-testing. Epic
- A deleted user
added database-testing-automation label
- Resolved by Tiger Watson
removed review request for @mwoolf
removed review request for @dfrazao-gitlab
requested review from @tigerwnz
added databasereviewed label and removed databasereview pending label
added databaseapproved label and removed databasereviewed label
- Resolved by Mikołaj Wawrzyniak
Ah, sorry @mikolaj_wawrzyniak it seems conflicting changes have been added to
structure.sql
, would you be able to fix these? I've approved for database, so feel free to merge
added 507 commits
-
84fa6dfb...4bfc014e - 506 commits from branch
master
- 7c60b263 - Add index on events using created_at and id
-
84fa6dfb...4bfc014e - 506 commits from branch
enabled an automatic merge when the pipeline for 5842d468 succeeds
mentioned in commit 43996cb8
added workflowstaging-canary label and removed workflowin review label
added workflowstaging label and removed workflowstaging-canary label
added workflowcanary label and removed workflowstaging label
mentioned in issue gitlab-org/charts/gitlab#2934 (closed)
mentioned in issue #345416
added workflowproduction label and removed workflowcanary label
added releasedcandidate label
added releasedpublished label and removed releasedcandidate label
mentioned in merge request !75722 (merged)
mentioned in issue gitlab-com/www-gitlab-com#12063 (closed)