In addition to statistic charts generated automatically by TeamCity on the Statistics tab, it is possible to configure your own statistical charts based on the set of statistic values provided by TeamCity or values reported from a build script. In the latter case you will need to configure your build script to report custom statistical data to TeamCity.
You can view statistic values reported by the build on the Build parameters page.
On this page:
- Managing Custom Charts via the TeamCity Web UI
- Managing Custom Charts Manually
Managing Custom Charts via the TeamCity Web UI
It is possible to manage custom charts using the TeamCity Web UI.
Adding Custom Charts
- The Statistics tab for a project or build configuration provides an option to create a new chart. Note that only one build configuration can be currently added as the data source. More configurations can be added manually.
- On the Parameters tab of the build results page, the list of Reported statistic values provides checkboxes to select the statistics type for a new project- or build-configuration-level chart.
- A project-level chart will be added to the selected target project. The root project cannot be selected as the target.
- A build-configuration-level chart will be added to all build configurations of the selected target project and its subprojects. Specifying the root project as the target will add the chart to all build configurations available on the server.
Modifying Custom Charts
Use the pencil icon to edit or delete a custom chart. Note that the Add Statistic Values drop-down displays all statistic values registered on the server without filtering them by build. If you select a value non-existent in the current build configuration or project when editing a chart, the chart will not be saved.
Using the cog icon, you can also configure the Y-axis settings and save them as defaults for all users.
There is a number of limitations to editing charts from the TeamCity UI.
Reordering Custom Charts
To reorder custom charts for a project/build configuration, click the Reorder button and drag-and-drop the charts to arrange them as required and apply your changes.
Managing Custom Charts Manually
To manually create custom charts to be displayed in the TeamCity web UI, configure the
TeamCity Data Directory
config/projects/ file. The file has the
<project-extensions> element which contains all project features, including custom charts. For each chart an
<extention> element is added.
Displaying Custom Chart in TeamCity Web UI
To make TeamCity display a custom chart in the web UI, update the
TeamCity Data Directory
config/projects/ configuration file adding a new
<extention> sub-element to the
Each extension must have a unique
id in the project.
type attribute is set to
<project-graphs>for Project-level chart
<buildType-graphs>for Build Configuration-level chart.
Each chart is described by the
<parameters> element. It must contain the <
param> sub-elements with data shown in the chart in
name/value pairs; the "
series" parameter uses the JSON format to list series of data shown on the chart.
See the example below:
Custom build configuration-level chart in project-config.xml
This chart will be shown on Statistics tabs of the Build Configurations of the project where the
project-config.xml file is located and all its subprojects. To display a chart for all Build Configurations, add it to the
project-config.xml of the Root Project.
The title above the chart.
The title above the list of series used on the chart (in the singular form). The default is "Serie".
The list of comma-separated options to be checked by default. Can include the following:
The list of comma-separated filter names that will not be shown next to the chart:
The format of the y-axis values. Supported formats are:
<series> parameter uses JSON format to list series of data shown on the chart. Each series is drawn in a separate color and you can choose one or another series using a filter.
The name of the valueType (series). It can be predefined by TeamCity, like
The series name shown in the series selector. Defaults to <key>. For several series, pattern group markers can be used:
This field allows you to explicitly specify a build configuration to use the data from for the given series. This field is mandatory for the first valueType used in a chart if the chart is added at the project level. In other cases it is optional. However, note that TeamCity chooses the build configuration to take the data from according to the following rules:
The color of a series to be used in the chart. Standard web color formats can be used - "#RRGGBB", color names, etc. For more information see HTML Colors reference and HTML Color Names reference. If not specified, an automatic color will be assigned based on the series title.
Pattern for names of the Value Types (or series) to be shown on the chart. The asterisk (*) sign is allowed to filter Value Types (or series) either predefined by TeamCity, like
You can set the custom chart width/height in pixels using the
properties.height attributes for the
param elements, e.g.
<param name="properties.width" value="300"/>.
Chart Axis Settings
You can also customize the default axis settings for a chart via parameter names starting with
properties, e.g. properties.axis.y.type
Whether the zero value is included on the Y axis:
An integer value to start the Y axis from.
An integer value to use as the maximum for the Y axis value .
Default Statistics Values Provided by TeamCity
The table below lists the predefined value providers that can be used to configure a custom chart. The values reported for each build differ depending on your build configuration settings.
You can view the all statistic values reported by the build on the Build Results | Parameters | Reported statistic values tab. For each of the values, a statistics chart is available on clicking the View Trend icon .
The sum of all artifact file sizes in the artifact directory
The sum of all artifact file sizes excluding hidden artifacts (those placed under .teamcity directory)
The duration of the artifact publishing step in the build
|The duration of each step. The build step names are generated automatically to avoid issues when a build step name is too long or a build step is renamed. The ID of each step can be found in the xml file of the build configuration.||Milliseconds|
The duration of the source checkout step
|The duration of resolving dependencies of the build||Milliseconds|
The build duration (all build stages)
|The build steps duration (excluding the checkout and artifact publishing time, etc.)||Milliseconds|
Block-level code coverage
Class-level code coverage
Line-level code coverage
Method-level code coverage
|The number of covered blocks||int|
|The total number of blocks||int|
The number of covered classes
The total number of classes
|The number of covered lines|
The total number of lines
|The number of covered methods|
The total number of methods
|The number of covered branches||int|
|The total number of branches||int|
|The number of covered statements||int|
|The total number of statements||int|
The number of code duplicates found
The total number of tests in the build
The number of successfully passed tests in the build
The number of failed tests in the build
The number of ignored tests in the build
The number of inspection errors in the build
The number of inspection warnings in the build
An indicator whether the build was successful
0 - failed, 1 - successful
How long the build was queued
Custom Build Metrics
If the predefined build metrics do not cover your needs, you can report custom metrics to TeamCity from your build script and use them to create a custom chart. There are two ways to report custom metrics to TeamCity:
Note that custom value keys should be unique and should not interfere with value keys predefined by TeamCity.