Get started

Blog

Metric of the Week: Code Cycle Time

Plandek, May 13, 2021

Metric Definition
Code Cycle Time is a key software delivery metric as it tracks the efficiency of the Pull Request process – which itself is a critical element of the end-to-end software delivery process.

More specifically, Code Cycle Time analyses all completed Pull Requests (PRs) (e.g. closed, merged, declined etc) within the specified time range and shows the average hours to complete, from when the PR was opened.

Not only that but Code Cycle Time provides full insight into the different stages that a PR goes through. These stages are defined as:

  1. Time to Review – From open to the first comment or review
  2. Time to Approve – From the previous stage to approved
  3. Time to Merge/Close – From the previous stage to merge/close
  4. Time to Deploy – From the previous stage to deployed

The method of calculation of Code Cycle Time is shown below:

Code Cycle Time Calculcation

Example Code Cycle Time chart – Plandek DevOps metrics dashboard

Example Code Cycle Time Chart

Analysis of Code Cycle Time – Breakdown and Filtering Options
Delivery metric dashboards like Plandek enable you to analyse delivery and engineering metrics at the team level in a number of different ways.

Below is a selection of the options available to analyse Code Cycle Time:

Author The individual who created the PR. Useful to filter down to a specific individual or individuals across many repos.
Participant Any individual who took action on the PR (not including the Author). Great way to see who are the go-to team members for reviews etc. 
Stage The specific stage the PR has been through (as defined above in the article). Essential to understand where time is being spent on average across your completed PRs.
Repository Allows you to see how Code Cycle Time compares across repos and if PRs in particular repos take longer than others.
Ticket Issue Type Based on ticket reference linking, you can gain a unique perspective on this metric based on any Ticket related field you have configured. In this case, you would be able to understand code cycle time based on the related ticket being a Story or Bug etc.

Example Code Cycle Time drill-down chart – Plandek DevOps metrics dashboard

Example Code Cycle Time Drill-down Chart

Related metrics
Code Cycle Time is one of many delivery and DevOps metrics. As such it is often used is part of a ‘balanced scorecard’ of software delivery metrics surfaced in real time at team and programme level.

Other such software delivery metrics and DevOps metrics include:

  • Development Cycle Time – looking at the time to develop an increment of software (from ideation to code completion only)
  • Lead Time – a broader software delivery metric looking at the complete end-to-end delivery process from ideation to deployment to live
  • Flow Efficiency – a related metric which analyses the friction within the end-to-end delivery process by identifying the proportion of time that tickets remain in an ‘active’ versus ‘inactive status’. Teams can then focus on reducing the time spent in inactive statuses (e.g ‘pending QA’) in order to increase velocity.

Key use cases
Code Cycle Time is a very useful DevOps metric to help teams reduce their Lead Time and increase the velocity of software delivery. The Pull Request process can become a key blocker in the overall delivery process as code awaits peer review. This may be because teams rely on a few key engineers to action the majority of Pull Requests and hence bottlenecks quickly develop.

Empirical data shows that Code Cycle Time typically accounts for circa 30% of Cycle Time – so the PR process is very often a key source of ‘hidden’ delay.

Code Cycle Time is particularly important for organisations looking to increase delivery velocity (reduce Lead Time) -e.g.:

  • delivery organisations at an early stage of Agile DevOps maturity
  • large scale delivery capabilities with distributed teams (onshore, offshore, contractor, inhouse) and potentially a higher turnover of engineering talent
  • teams involved in strategically critical software delivery projects.

Expected outcomes
Reducing Code Cycle Time will reduce overall Lead Time and increase software delivery velocity. Empirical evidence shows that it is not uncommon to reduce Lead Time by 5-10% through tracking and effective management of Code Cycle Time.

Detailed analysis will also reveal the engineers responsible for actioning the majority of PRs and can help Team Leads reduce the pressure on these key individuals – thereby reducing pressure on the individuals themselves and at the same time reducing the ‘key-person’ risk within the software delivery capability.

About Plandek
Plandek works by mining data from toolsets used by delivery teams (such as Jira, Git, CI/CD tools and Slack), to provide end-to-end delivery metrics/analytics to optimise software delivery predictability, risk management and process improvement.

Plandek is a global leader in this fast-growing field, recognised by Gartner as a top nine global vendor in their DevOps Value Stream Management Market Guide (published in Sept 2020).
Plandek is based in London and works with clients globally to apply predictive data analytics and machine learning to deliver software more effectively.

share this post