TeamCity Plugin Development Help Help

Custom Statistics

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:

public MyExtension(ChartProviderRegistry registry, ProjectManager manager) { registry.getChartProvider("project-graphs").registerChart(manager.findProjectByExternalId("externalId"), createGraphBean()); // "project-graphs" for Project Statistics Tab // "buildtype-graphs" for Build Configuration Statistics Tab } public GraphBean createGraphBean() { // creates GraphBean }

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:

new ModelAndView("/buildGraph.html?jsp=" +myDescriptor.getPluginResourcesPath("sampleChartPage.jsp"))'

To insert statistics chart into the sampleChartPage.jsp:

<%@taglib prefix="stats" tagdir="/WEB-INF/tags/graph"%> <stats:buildGraph id="g1" valueType="BuildDuration"/>

Customize Chart Appearance




width, height

modify the chart image size

Integer value


suppress filter controls

Comma separated filters names: all, series, average, showFailed, range, yAxisType, forceZero, yAxisRange


default filter state

Comma separated names: showFailed, averaged, logYAxis, autoscale


chart style

Set to rendererB for a bar chart

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.

See also:

Extending TeamCity: Build Script Interaction with TeamCity

Last modified: 21 July 2020