April 20, 2017
VSTSDevOpsTFS

Query TFS/VSTS for past build history

We’re using TFS on premise (2017, not an update) to run builds, track work, etc at my current client. This should also work on VSTS (which I hope we will get to move towards someday).

I was asked to figure out why our build times have increased over the last couple months. My first task was to get the metrics. After not finding the graph I wanted in the charts in the TFS dashboard, I turned to the TFS API.

I will probably add to this, but this works for me. It spits out a csv that I can use Excel to create an easy chart. This could morph into a TFS extension chart (which would be great, but more work and time than I have right now). We could even run this automatically and alert if the build time goes over a certain threshold. That could mean we have problems (see the DevOps Handbook Chapter 14 on the importance of metrics).