Measuring pull request cycle time in Azure DevOps

Has anyone tried to measure pull request cycle time in AzDo? I know there’s a few options for work item cycle time measurement/charting/etc, but I’m particularly interested in PR cycle time. I know in a perfect working model, there’d be a single work item corresponding exactly to each PR, but… we don’t have that.

Take the number of devs working in a repo, measure the average pull requests across a working week/month/etc, divide the number of dev hours by the average number of pull requests, you’ve got a very rough cycle time.

If you want to plot out each one for datapoints, you’ll need to change how you do work items.

Nice back of envelope cycle time, fair point - thanks

I think long term I’m hoping for a per-team measurement (most of our teams work out of the same monorepo) so I probably need to get the thinking cap on (or start taking the sales calls from Pluralsight Flow etc etc :slightly_smiling_face: )

Problem of PR cycle time is that the PR is only created once the work is done… So you’d miss the initial work. If you want to measure how long PRs are open awaiting review, remember that the open time on a product/project team should be minimal, it’s the cycle time on pull requests from other teams outside of the product that are interesting to measure.

If you know you need to measure your PR cycle time, you probably know you have a problem anyway ;).

You may be able to use the commit dates in the PR to get a more accurate start-time if the work in the PR.

If you are just looking for the time a PR is open, you can get that data from the Pull Request objects from the rest api.

It has a creation and a closed date. And of you call the api with the option to include the commit Metadata, you can look at the commit date of the first commit to measure the time from first commit to merge.

https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/get%20pull%20request|https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/get%20pull%20request

Ahh, I love an excuse to write some code. Perhaps this is my opportunity :wink:

> If you know you need to measure your PR cycle time, you probably know you have a problem anyway
You nailed it!

I’d love to see the PR cycle time on your coding endeavor.

PS: in that PR REST call you can also grab the Work Items to see whether those went to in-progress way before the first commit. But any data derived from that is speculation.

To be honest, I would love to see the pr cycle before and after changes to that process, fx through templates…
Definitely interested to hear if you find anything of value for your projects!

It’s on my TODO list rather than my “urgent drop everything” list, so it might be a while. But I’ll do my best to feedback when I have some data.