gitlab-org--gitlab-foss/app/services
Stan Hu 5416ab8a0d Merge branch '21170-cycle-analytics' into 'master'
Cycle Analytics: first iteration

## What does this MR do?

- Implement the first iteration of the "Cycle Analytics" feature.

## What are the relevant issue numbers?

- Closes #21170 

## Screenshots

![cycle_analytics_screencast.gif](/uploads/d23c3c912caa6935fd47b53ca3a56b97/cycle_analytics.gif)

## Backend Tasks

- [x]  Implementation
    - [x]  Phases
        - [x]  Issue (Tracker)
        - [x]  Plan (Board)
        - [x]  Code (IDE)
        - [x]  Test (CI)
        - [x]  Review (MR)
        - [x]  Staging (CD)
        - [x]  Production (Total)
    - [x]  Make heuristics more modular
    - [x]  Scope to project
    - [x]  Date range (30 days, 90 days)
    - [x]  Access restriction
- [x]  Test
    - [x]  Find a better way to test these phases
    - [x]  Phases
        - [x]  Issue (Tracker)
        - [x]  Plan (Board)
        - [x]  Code (IDE)
        - [x]  Test (CI)
        - [x]  Review (MR)
        - [x]  Staging (CD)
        - [x]  Production (Total)
    - [x]  Test for "end case happens before start case"
    - [x]  Consolidate helper
- [x]  Miniboss review
- [x]  Performance testing with mock data
- [x]  Improve performance
    - [x]  Pre-calculate "merge requests closing issues
    - [x]  Pre-calculate everything else
- [x]  Test performance against 10k issues
- [x]  Test all pre-calculation code
    - [x]  Ci::Pipeline -> build start/finish
    - [x]  Ci::Pipeline#merge_requests
    - [x]  Issue -> record default metrics after save
    - [x]  MergeRequest -> record default metrics after save
    - [x]  Deployment -> Update "first_deployed_to_production_at" for MR metrics
    - [x]  Git Push -> Update "first commit mention" for issue metrics
    - [x]  Merge request create/update/refresh -> Update "merge requests closing issues"
- [x]  Remove `MergeRequestsClosingIssues` when necessary
- [x]  Changes to unblock Fatih
    - [x]  Add summary data
    - [x]  `stats` should be array
    - [x]  Let `stats` be `null` if all `stats` are null
- [x]  Indexes for "merge requests closing issues"
- [x]  Test summary data
- [x]  Scope everything to project
    - [x]  Find out why tests were passing
- [x]  Filter should include issues/MRs which have made it to production within the range
- [x]  Don't create duplicate `MergeRequestsClosingIssues`
- [x]  Fix tests
- [x]  MySQL median
- [x]  Assign to Douwe for review
- [x]  Fix conflicts
- [x]  Implement suggestions from Yorick's review
    - [x]  Test on PG
    - [x]  Test on MySQL
- [x]  Refactor
    - [x]  Cleanup
        - [x]  What happens if we have no data at all?
        - [x]  Extract common queries to methods / scopes
    - [x]  Remove unused queries
    - [x]  Downtime for foreign key migrations
    - [x]  Find a way around "if issue.metrics.present?" all over the place
    - [x]  Find a way around "if merge_request.metrics.present?" all over the place
    - [x]  Test migrations on a fresh database
        - [x]  MySQL
        - [x]  Pg
- [x]  Access issues
    - While the project is public and the visibility is set to "Everyone with access", you cannot visit the cycle analytics page when signed out.
- [x]  CHANGELOG
- [x]  Implement suggestions from Douwe's review
    - [x]  First set of comments
    - [x]  Second set of comments
    - [x]  Third set of comments
    - [x]  Fourth set of comments
- [x]  Make sure build is green
- [ ]  Make issue for "polish"
- [ ]  EE MR


See merge request !5986
2016-09-21 05:05:02 +00:00
..
auth Improve code comments 2016-09-16 12:46:33 +02:00
boards Fix issue boards leak private label names and descriptions 2016-08-29 16:04:28 -03:00
ci Make the cases clear instead of having guards 2016-09-12 18:49:58 +08:00
commits Reduce duplication in Commits::{CherryPickService,RevertService} 2016-09-15 16:30:27 +02:00
files Add optional 'author' param when making commits 2016-09-19 10:00:26 -07:00
groups
issuable Add bulk update support for merge requests list 2016-09-08 11:52:20 +03:00
issues Add bulk update support for merge requests list 2016-09-08 11:52:20 +03:00
members Ensure last group owner isn't removed on expiry 2016-08-18 21:32:42 +01:00
merge_requests Add a spec for merge request metric caching while refreshing a merge request from a forked project. 2016-09-21 02:15:02 +05:30
milestones Ensure validation messages are shown within the milestone form 2016-09-19 09:29:12 +01:00
notes Ensure we have a user before checking for their permission in Notes::SlashCommandsService 2016-09-20 13:58:14 +02:00
oauth2 Enable Style/EmptyLinesAroundAccessModifier rubocop cop 2016-06-03 10:34:20 +02:00
projects Merge branch 'pushes-since-gc-redis' into 'master' 2016-09-13 23:35:42 +00:00
protected_branches Backport changes from gitlab-org/gitlab-ee!581 to CE. 2016-08-16 11:05:14 +05:30
search
slash_commands Fix behavior around commands with optional arguments 2016-08-18 14:29:49 -05:00
wiki_pages Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
akismet_service.rb Reduce duplication in AkismetService 2016-09-20 08:19:32 +03:00
audit_event_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
base_service.rb remove Ability.abilities 2016-08-30 11:35:06 -07:00
compare_service.rb switch from diff_file_collection to diffs 2016-08-03 07:00:20 +02:00
create_branch_service.rb Fix of 'Commits being passed to custom hooks are already reachable when using the UI' 2016-07-19 07:45:22 +03:00
create_deployment_service.rb Implement a second round of review comments from @DouweM. 2016-09-21 00:47:37 +05:30
create_release_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
create_snippet_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
create_tag_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
delete_branch_service.rb Simplify the name for data builder, feedback: 2016-08-12 16:09:29 +08:00
delete_tag_service.rb Simplify the name for data builder, feedback: 2016-08-12 16:09:29 +08:00
delete_user_service.rb Fix bug where destroying a namespace would not always destroy projects 2016-08-11 15:36:35 -07:00
destroy_group_service.rb Fix bug where destroying a namespace would not always destroy projects 2016-08-11 15:36:35 -07:00
event_create_service.rb
git_hooks_service.rb Better message for git hooks and file locks 2016-07-04 15:31:49 +03:00
git_push_service.rb Implement review comments from @yorickpeterse 2016-09-20 16:05:25 +05:30
git_tag_push_service.rb Simplify the name for data builder, feedback: 2016-08-12 16:09:29 +08:00
gravatar_service.rb
ham_service.rb Further refactor and syntax fixes. 2016-08-15 17:20:57 -05:00
import_export_clean_up_service.rb using shared path for project import uploads and refactored gitlab remove export worker 2016-08-04 12:51:55 +02:00
issuable_base_service.rb Use the IssuableBaseService lifecycle hooks to cache MergeRequestsClosingIssues 2016-09-21 01:22:20 +05:30
notification_service.rb Fix notification_service argument error of declined invitation emails 2016-08-19 13:18:13 +02:00
repair_ldap_blocked_user_service.rb
repository_archive_clean_up_service.rb using shared path for project import uploads and refactored gitlab remove export worker 2016-08-04 12:51:55 +02:00
spam_service.rb Further refactor and syntax fixes. 2016-08-15 17:20:57 -05:00
system_hooks_service.rb Revert "Fix merge conflicts - squashed commit" 2016-06-03 11:10:17 +02:00
system_note_service.rb Capitalize mentioned issue timeline notes 2016-08-25 10:47:40 -05:00
test_hook_service.rb Simplify the name for data builder, feedback: 2016-08-12 16:09:29 +08:00
todo_service.rb Refresh todos count cache when an Issue/MR is deleted 2016-09-08 15:50:07 -03:00
update_release_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
update_snippet_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
user_agent_detail_service.rb Further refactor and syntax fixes. 2016-08-15 17:20:57 -05:00