Skip to end of metadata
Go to start of metadata
You are viewing documentation of TeamCity 6.5.x, which is not the most recent released version of TeamCity. Please refer to the listing to choose another version.
Search

Table of Contents

In addition to statistic charts generated automatically by TeamCity, it is possible to configure your own statistical charts based on the set of build metrics provided by TeamCity or values reported from build script. In the latter case you will need to configure your build script to report custom statistical data to TeamCity.

Displaying a custom chart in TeamCity web UI

To make TeamCity display a custom chart in web UI, you need to update dedicated configuration file:

You can edit these files while the server is running, they will be automatically reloaded.

Project page has charts added by default, see details.

A statistics chart is added using graph tag. See the examples below:

Custom project-level charts in plugin-settings.xml

Custom build configuration-level charts in main-config.xml

Note, that when adding custom charts on the project level intermediate custom-graphs tag is required.

Tags reference

<graph> : describes a single chart. It should contain one or more valueType subtags, which describe series of data shown in the chart.

Attribute

Description

title

Title above the chart.

seriesTitle

Title above list of series used on the chart (in singular form). Default is "Serie".

defaultFilters

List of comma-separated options, which should be checked by default. Can include the following:

  • showFailed — include results from failed builds by default.
  • averaged — by default, show averaged values on the chart.

hideFilters

List of comma-separated filter names that should not be shown next to the chart:

  • all — hide all filters.
  • series — hide series filter (you won't be able to show only data from specific valueType specified for the chart.
  • range — hide date range filter.
  • showFailed — hide checkbox which allows to include data for failed builds.
  • averaged — hide checkbox which allows to view averaged values.
    Defaults — empty (all filters are shown).

<valueType> : describes a series of data shown on the chart. Each series is drawn with a separate color and you may choose one or another series using a filter.

Attribute

Description

key

A name of the valueType (or series). It can be predefined by TeamCity, like BuildDuration or ArtifactsSize (see below the complete list of pre-defined build metrics), or you can provide your own data by reporting it from the build script.

title

Series name, shown in the series selector. Defaults to <key>.

buildTypeId

This field allows to explicitly specify build configuration to use data from for given valueType. This field is mandatory for the first valueType used in a chart, if the chart is added at project level. In other cases it is optional. However, note that TeamCity chooses build configuration to take data from according to following rules:

  1. if buildTypeId is set within valueType, data is taken from this build configuration even if it belongs to another project.
  2. if buildTypeId is not set within current valueType, but it is set in valueType above current one within the chart, the data from the build configuration referenced above will be taken. See example for plugin-settings.xml file above.
  3. if buildTypeId is not set within current valueType and is not set above, the chart will show data for the current build configuration, i.e. this chart will work only for build configurations. Such charts can be configured only in main-config.xml.

Build Metrics Provided by TeamCity

The following lists the pre-defined value providers that can be used to configure a custom chart. Using these values doesn't require build script modification.

Value

Description

Unit

ArtifactsSize

Sum of all artifact file sizes in artifact directory.

Bytes

BuildArtifactsPublishingTime

Duration of the artifact publishing step in the build.

Milliseconds

BuildCheckoutTime

Duration of the source checkout step.

Milliseconds

BuildDuration

Build duration, excluding checkout or artifact publishing time.

Milliseconds

CodeCoverageB

Block-level code coverage

%

CodeCoverageC

Class-level code coverage

%

CodeCoverageL

Line-level code coverage

%

CodeCoverageM

Method-level code coverage

%

CodeCoverageAbsLCovered

Number of covered lines

int

CodeCoverageAbsMCovered

Number of covered methods

int

CodeCoverageAbsCCovered

Number of covered classes

int

CodeCoverageAbsLTotal

Total number of lines

int

CodeCoverageAbsMTotal

Total number of methods

int

CodeCoverageAbsCTotal

Total number of classes

int

DuplicatorStats

Number of found code duplicates

int

FailedTestCount

Number of failed tests in the build

int

IgnoredTestCount

Number of ignored tests in the build

int

InspectionStatsE

Number of inspection errors in the build

int

InspectionStatsW

Number of inspection warnings in the build

int

PassedTestCount

Number of successfully passed tests in the build

int

SuccessRate

Indicator whether the build was successful

0 - failed, 1 - successful

TimeSpentInQueue

How much time build was in queue

Milliseconds

Custom Build Metrics

If pre-defined 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.



See also: