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

Statistics customization

Last modified: 20 April 2023

TeamCity provides number of ways to customize statistics. You can add your own custom metrics to integrate your tools/processes, insert any stats graph/report into any extension place, etc.

Quick start



  • Easy way to just insert jsp fragment into WebPlace — use a helper bean

    <bean id="myLogoFragment" class="jetbrains.buildServer.web.openapi.SimpleWebExtension" init-method="register">
        <property name="name" value="myLogoFragment"></property>
        <property name="place" value="PAGE_HEADER"></property>
        <property name="jspPath" value="/myLogoFragment.jsp"/>
      </bean>
  • How to insert statistics chart into jsp page

    <%@taglib prefix="stats" tagdir="/WEB-INF/tags/graph"%>
    <stats:buildGraph id="g1" valueType="BuildDuration"/>
  • Easy way to add a custom build metric: Extend BuildValueTypeBase to just define your build metric calculation method, appearance and key - now you can reference this metric by its key in statistics chart/report tags

More details



BuildType Statistics tab extension point

customizing appearance

  • width, height - graph image size

  • hideFilters - suppress filter controls

Details on how to add custom metrics

  • Implement jetbrains.buildServer.serverSide.statistics.ValueType

  • Register it via jetbrains.buildServer.serverSide.statistics.StatsManager

Details on custom Build metrics

  • Implement jetbrains.buildServer.serverSide.statistics.build.BuildFinishAware in your ValueType to be notified of build finished event

  • calculate your metric

  • Employ jetbrains.buildServer.serverSide.statistics.build.BuildDataStorage to publish your value

  • Employ jetbrains.buildServer.serverSide.statistics.build.BuildDataStorage to retrieve your dataset