TeamCity
 
You are viewing the documentation for an earlier version of TeamCity.

Custom Statistics

Last modified: 20 April 2023

TeamCity provides a number of ways to customize statistics. You can add your own custom metrics to integrate your tools/processes, insert any statistical chart/report into statistic page extension places and so on.

This page describes programmatic approaches to statistics customization. For user-level customizations, please refer to the Custom Chart page.

Customize TeamCity Statistics Page



Add Chart



To add a chart to the Statistics tab for a project or build configuration, use the ChartProviderRegistry bean:

Add Custom Content



To add custom content to the Statistics tab for a project or build configuration, use the following example here and the appropriate PlaceId:

    • for Build Configuration Statistics tab, use PlaceId.BUILD_CONF_STATISTICS_FRAGMENT

    • for Project Statistics tab, use PlaceId.PROJECT_STATS_FRAGMENT.

Add Statistics to your Custom Pages



To add charts to your custom JSP pages, use the <buildGraph> tag and a special controller accessible on "/buildGraph.html". It requires the jsp attribute leading to your page:

To insert statistics chart into the sampleChartPage.jsp:

Customize Chart Appearance



Add Custom Build Metrics



To add a custom build metric, in addition to the built-in methods, you can extend BuildValueTypeBase to define your build metric calculation method, appearance, and key. After that you can reference this metric by its key in statistics chart/report tags.