TeamCity installation-wide statistics Follow
We offer a TeamCity installation (with a number of build agents) as a shared resource to a number of distributed technology departments, across our mid-size company. Although we have a qualitative sense of how many departments and technologists are using our TeamCity installation, we'd like to start gathering some quantitative metrics around the use of this installation and the use of TeamCity in general.
Is it possible for us to gather installation-wide metrics and statistics (i.e. NOT PROJECT SPECIFIC)?
We're looking for metrics such as:
- # of projects in TeamCity
- # of builds processed hourly/daily
- # of build failures hourly/daily
- # of test-runs
- Min/Avg/Max # of test failures per run
- Min/Avg/Max amount of time it takes to do each test-run
Any help would be greatly appreciated.
Please sign in to leave a comment.
For the time being there is no built-in ability in TeamCity to do that.
All you mentioned is possible by writing a custom Java plugin to TeamCity. The data storage and charts on web UI should be managed by the plugin, bacause there is no services provided by the core at this time. If you choose to write the plugin you are welcome to ask API questions, etc. in the forums.
I also filed an issue to address such ability (limited with more broad stats, like # of projects, etc.). Feel free to vote for it.
Do you know for a fact that by writing a plug-in, you have the right APIs exposed which will let me get to this data? Or are you just guessing?
With TeamCity open API you definitely will be able to gather required metrics.
# of projects in TeamCity
# of builds processed hourly/daily
# of build failures hourly/daily
This can be calculated with help of SQL query based on data in history table. Alternatively you can use methods of jetbrains.buildServer.serverSide.BuildHistory class.
# of test-runs
Min/Avg/Max # of test failures per run
Each build has information about tests statistics, see SBuild::getShortStatistics()
Min/Avg/Max amount of time it takes to do each test-run
For this you should use SBuild::getFullStatistics(). Returned BuildStatistics instance will contain TestBlockBean objects with duration.
Hope this helps.
Thanks so much for getting back to me.
For the History table that you mentioned, is that a recommended approach or should we stick to the APIs?
Is your database schema of the tables I can use (aside from the History tables) to get to this data published so that I can reference it?
SQL schema is not published and we can't guarantee it will not change in the future. However changes in SQL schema are rarely significant. In most cases we add new tables or new columns. I mentioned history table because SQL query can work faster in your case.
I'm wondering whether any progress has been made toward this? I'm even happy if I can get project cumulative statistics. For instance, total tests run/passed/failed for an entire project in one day? With custom stats, I seem to only be able to put N values on the same chart, not a sum of them... or average.
Also, did you have any luck with the plugin you wrote?
> For instance, total tests run/passed/failed for an entire project in one day?
Does not look like something related to server-wide statistics and should probably be addressed as a totally separate issue.
You can file a feature request into our tracker for this. Please describe use cases and why do you need this type of data.