Introduced in GitLab 8.12. Further features were added in GitLab 8.14.
Cycle Analytics measures the time it takes to go from an idea to production for each project you have. This is achieved by not only indicating the total time it takes to reach at that point, but the total time is broken down into the multiple stages an idea has to pass through to be shipped.
Cycle Analytics is that it is tightly coupled with the GitLab flow and calculates a separate median for each stage.
You can find the Cycle Analytics page under your project's Pipelines ➔ Cycle Analytics tab.
You can see that there are seven stages in total:
Issue (Tracker)
Plan (Board)
Code (IDE)
Test (CI)
Review (Merge Request/MR)
Staging (Continuous Deployment)
Sum of all the above stages' times excluding the Test (CI) time. To clarify, it's not so much that CI time is "excluded", but rather CI time is already counted in the review stage since CI is done automatically. Most of the other stages are purely sequential, but Test is not.
Cycle Analytics records cycle time and data based on the project issues with the exception of the staging and production stages, where only data deployed to production are measured.
Specifically, if your CI is not set up and you have not defined a production
or production/*
environment, then you will not have any data for those stages.
Below you can see in more detail what the various stages of Cycle Analytics mean.
Stage | Description |
---|---|
Issue | Measures the median time between creating an issue and taking action to solve it, by either labeling it or adding it to a milestone, whatever comes first. The label will be tracked only if it already has an Issue Board list created for it. |
Plan | Measures the median time between the action you took for the previous stage, and pushing the first commit to the branch. The very first commit of the branch is the one that triggers the separation between Plan and Code, and at least one of the commits in the branch needs to contain the related issue number (e.g., #42 ). If none of the commits in the branch mention the related issue number, it is not considered to the measurement time of the stage. |
Code | Measures the median time between pushing a first commit (previous stage) and creating a merge request (MR) related to that commit. The key to keep the process tracked is to include the issue closing pattern to the description of the merge request (for example, Closes #xxx , where xxx is the number of the issue related to this merge request). If the issue closing pattern is not present in the merge request description, the MR is not considered to the measurement time of the stage. |
Test | Measures the median time to run the entire pipeline for that project. It's related to the time GitLab CI takes to run every job for the commits pushed to that merge request defined in the previous stage. It is basically the start->finish time for all pipelines. master is not excluded. It does not attempt to track time for any particular stages. |
Review | Measures the median time taken to review the merge request, between its creation and until it's merged. |
Staging | Measures the median time between merging the merge request until the very first deployment to production. It's tracked by the environment set to production or matching production/* (case-sensitive, Production won't work) in your GitLab CI configuration. If there isn't a production environment, this is not tracked. |
Production | The sum of all time (medians) taken to run the entire process, from issue creation to deploying the code to production. |
Here's a little explanation of how this works behind the scenes:
<issue, merge request>
pair, the merge request has the issue closing pattern for the corresponding issue. All other issues and merge requests are not considered.<issue, merge request>
pairs, we check the information that we need for the stages, like issue creation date, merge request merge time, etc.To sum up, anything that doesn't follow the GitLab flow won't be tracked at all. So, the Cycle Analytics dashboard won't present any data:
production
or production/*
environment.Below is a simple fictional workflow of a single cycle that happens in a single day passing through all seven stages. Note that if a stage does not have a start/stop mark, it is not measured and hence not calculated in the median time. It is assumed that milestones are created and CI for testing and setting environments is configured.
.gitlab-ci.yml
and takes 5min (stop of Test stage).production
environment starts and finishes at 19:30 (stop of Staging stage).From the above example you can conclude the time it took each stage to complete as long as their total time:
A few notes:
The current permissions on the Cycle Analytics dashboard are:
You can read more about permissions in general.
Learn more about Cycle Analytics in the following resources: