Provide metrics that would help us to detect the potential N+1 CACHED SQL calls
## Metrics ### Controller#action #### [Request db_count and db_cached_count per controller#action last 5 days](https://log.gprd.gitlab.net/goto/51069992772548efa4434245e6e72048) #### [Request db_count and db_cached_count per controller#action and root_namespace for last 5 days](https://log.gprd.gitlab.net/goto/c2661ccad683485b7f4799d388dbaa27) #### [Request db_cached_count per json_path (internal)](https://log.gprd.gitlab.net/goto/c8bf34acebdb1ebbe0abcc7fe7dad224) | json.meta.caller_id.keyword: Descending | Count | Max json.db_cached_count | 50th percentile of json.db_cached_count | 95th percentile of json.db_cached_count | |-----------------------------------------------|-------|--------------------------|-----------------------------------------|-----------------------------------------| | Import::BitbucketServerController#create | 433 | 2801 | 50 | 2669 | | Projects::GroupLinksController#create | 1312 | 6578 | 4.72727272727273 | 175.366666666665 | | Groups::GroupLinksController#update | 30 | 4220 | 14 | 614 | | Groups::GroupLinksController#create | 176 | 12496 | 9 | 251 | | Import::GitlabProjectsController#create | 1189 | 6483 | 3 | 275 | | GroupsController#transfer | 257 | 2829 | 14 | 218.199999999999 | | ProjectsController#transfer | 3349 | 6481 | 2 | 68.1249999999999 | | Projects::PipelinesController#create | 27331 | 6749 | 4 | 249.93861349154 | | Groups::IssuesController#bulk_update | 308 | 149 | 34.1666666666667 | 132 | | Projects::IssuesController#bulk_update | 2080 | 401 | 29 | 101 | | Groups::GroupLinksController#destroy | 25 | 620 | 9 | 281.75 | | Profiles::SlacksController#edit | 261 | 4975 | 0 | 118 | | Boards::IssuesController#bulk_move | 119 | 383 | 23 | 96.55 | | Groups::MergeRequestsController#bulk_update | 12 | 103 | 15 | 100.9 | | Projects::MergeRequestsController#bulk_update | 180 | 318 | 9.5 | 137 | | Groups::MilestonesController#destroy | 41 | 180 | 7 | 148.55 | | ProjectsController#create | 70887 | 12545 | 0 | 17.6502476190476 | | Projects::MilestonesController#destroy | 165 | 1713 | 3 | 49.25 | | Projects::ForksController#create | 3945 | 6470 | 0 | 14 | | Projects::GroupLinksController#destroy | 161 | 1310 | 6 | 41.1499999999999 | | Admin::UsersController#projects | 11 | 164 | 0 | 156.95 | | Groups::MilestonesController#labels | 28 | 233 | 7 | 51.1999999999996 | | GroupsController#update | 2155 | 3679 | 0 | 14.9642857142857 | | Projects::GroupLinksController#update | 155 | 473 | 2 | 37.5 | | Groups::EpicLinksController#create | 60 | 138 | 4 | 35 | | Groups::EpicLinksController#destroy | 16 | 68 | 9 | 51.8 | | Import::BitbucketController#create | 601 | 1126 | 0 | 52 | | Projects::IssuesController#move | 1338 | 303 | 10 | 18 | | Projects::DiscussionsController#resolve | 70435 | 135 | 10 | 20 | | Projects::DiscussionsController#unresolve | 3148 | 84 | 10 | 19 | ### Sidekiq Workers metrics #### [Kibana - Sidekiq DB Cache calls per project](https://log.gprd.gitlab.net/goto/c0e4a3f5bb40b3f6221c886fe2473a51) #### [Sidekiq DB Cache calls per worker ](https://log.gprd.gitlab.net/goto/d7455398f2a4b4bcbd0967b43ab33802) | json.class.keyword: Descending | Count | Max json.db_cached_count | 50th percentile of json.db_cached_count | 95th percentile of json.db_cached_count | 50th percentile of json.db_count | 95th percentile of json.db_count | |------------------------------------------------------|-----------|--------------------------|-----------------------------------------|-----------------------------------------|----------------------------------|----------------------------------| | ProjectExportWorker | 9,717 | 47,191 | 6 | 116.9 | 174.093 | 3,054.025 | | ExportCsvWorker | 353 | 31,867 | 85 | 1,976.6 | 106.5 | 2,008.2 | | ReactiveCachingWorker | 340,929 | 22,088 | 0 | 105.81 | 11 | 230.706 | | ExpireBuildArtifactsWorker | 59 | 10,700 | 0 | 10,615 | 0 | 74,412.15 | | UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker | 1 | 7,070 | 7,070 | 7,070 | 52,579 | 52,579 | | UpdateMergeRequestsWorker | 308,722 | 6,686 | 14 | 69.381 | 153.965 | 411.817 | | PostReceive | 2,046,361 | 4,119 | 0 | 8 | 37 | 165.145 | | RepositoryUpdateMirrorWorker | 5,858,572 | 3,459 | 0 | 0 | 18 | 22 | | AutoMergeProcessWorker | 47,098 | 3,193 | 0 | 10.372 | 5 | 142.479 | | RunPipelineScheduleWorker | 300,901 | 2,880 | 0 | 44.419 | 25.481 | 183.008 | | UpdateExternalPullRequestsWorker | 68,853 | 2,062 | 0 | 0 | 3 | 3.058 | | PipelineHooksWorker | 2,706,120 | 1,963 | 3 | 18.462 | 22 | 51.002 | | VulnerabilityExports::ExportWorker | 9 | 1,667 | 556 | 1,667 | 1,173 | 2,585 | | NewMergeRequestWorker | 185,450 | 1,390 | 7 | 29.141 | 63 | 188.706 | | ElasticIndexInitialBulkCronWorker | 1,210 | 1,244 | 0 | 0 | 4 | 22 | | InvalidGpgSignatureUpdateWorker | 197 | 1,027 | 0 | 120 | 3 | 603 | | RepositoryImportWorker | 5,930 | 998 | 0 | 3 | 38 | 187.867 | | ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper | 3,023,049 | 887 | 4 | 16 | 24 | 47 | | ElasticIndexBulkCronWorker | 2,902 | 552 | 55.714 | 154.233 | 325.284 | 606 | | CreateCommitSignatureWorker | 38,410 | 500 | 2 | 12.482 | 12 | 42.96 |
issue