How do I define custom charts, project and configuration level?

I'm trying to follow the help documentation for TeamCity 4.5:
http://www.jetbrains.net/confluence/display/TCD4/Build+Script+Interaction+with+TeamCity
http://www.jetbrains.net/confluence/display/TCD4/Custom+Chart

I have my ant build targets outputting service messages like:

<echo>##teamcity[buildStatisticValue key='compexityThreshold' value='100']</echo>

Which are appearing in the build log.


I have a custom graph in my main-config.xml like:

<server>
...
<graph title="Complexity">
    <valueType key="complexityThreshold" title="Threshold" buildTypeId="bt47" />
  </graph>
</server>

(where 'bt47' is the correct build configuration id)

I can't see this graph appearing anywhere, I assume it supposed to be against the project statistics?


I tried to put the information into the project-config.xml, but the structure defined in the help files doesn't seem to fit in!

<!--Jetbrains example-->
<settings>
  <custom-graphs>
   <graph title="Duration comparison" hideFilters="showFailed" seriesTitle="some keys">
      <valueType key="BuildDuration" title="duration2" buildTypeId="bt7"/>
      <valueType key="BuildDuration" title="duration1" buildTypeId="bt3"/>
      <valueType key="customKey" title="Custom data" /> <!-- Will use data from build configuration bt3 -->
   </graph>
  </custom-graphs>
</settings>

None of these xml tags are valid below the root element <project>, or the <build-type> element... I can't see any reference to them in the project-config.dtd either.


Any advice would be appreciated!

Will

8 comments
Comment actions Permalink

Hey Will, there seems to be a typo in the key name of the service message as output in the <echo/> element.

0
Comment actions Permalink

Ah yes.. thanks.. I'm sure I checked that a dozen times!

Graphs are now appearing, so I'm now adding some more metrics into that graph.

I'm still not sure about the doco around modifying project-config.xml - it doesn't seem to be neccesary?

0
Comment actions Permalink

It's kinda weird.  You modify the specific project-config.xml to add to the project level statistics.  But you change the main-config for adding statistics to a build config within a project.

0
Comment actions Permalink

hi,

I met the same problem and can't see the custom chart.
I use the TeamCity 5.0 windows version.
If I put the <graph> ... </graph> code snippet in the main-config.xml, nothing shows in the build statistics tab; if I put it in the project-config.xml, the project statistic tab is empty while error showed in the webpage: "Element type "custom-graphs" must be decleared.".
After checking the dtd file of main-config and project-config, there's no such element or attribute definition.

Hope anyone can help me figure out this stuff. Thank you in advance.

Best regards,
cdgray

0
Comment actions Permalink

Please make sure you've published at least one statistics value. After that try to add graph again. If it does not work, please provide graph xml snippet.

0
Comment actions Permalink

Hi Pavel,

Here's the steps I made,

1. modify main-config.xml file in the .BuildServer\config folder, add following contents after </comment-transformation>element,
     <graph title="Custom data">
          <valueType key="key1" title="Metric1" />
          <valueType key="key2" title="Metric2" />
     </graph>

2. create a teamcity-info.xml, the contents are
     <build>
          <statisticValue key="chart1Key" value="342">
          <statisticValue key="chart1Key" value="53">
     </build>

3. create a new build configuration, set the checkout directory as "graph", run the build to create the checkout folder in the TeamCity\buildAgent\work folder

4. copy the teamcity-info.xml to the "graph" folder and run the build again

5. the teamcity-info.xml file disapprears after build, but in the build configuration's "statistic" tab, there's no custom graph shows

Is there any wrong step I make?

Best regards,
cdgray

0
Comment actions Permalink

In teamcity-info.xml you should use the same key names as defined in <graph/> element of main-config.xml

0
Comment actions Permalink

hi Pavel,

sorry for reply so late.

i did another test according to your advice, here'e the step,

1a. modify main-config.xml file in the .BuildServer\config folder, add following contents after </comment-transformation>element,
     <graph title="Custom data">
          <valueType key="key1" title="Metric1" />
          <valueType key="key2" title="Metric2" />
     </graph>

1b. create a "my_custom_graph" project and create a "graph" build configuration, set the checkout directory as "graph", modify plugin-settings.xml file in the ".BuildServer\config\my_custom_graph" folder, add following contents,
     <custom-graphs>
          <graph title="Custom data" seriesTitle="seriesTitle">
               <valueType key="key1" title="Metric1" buildTypeId="bt11" />
               <valueType key="key2" title="Metric2" buildTypeId="bt11" />
          </graph>

     </custom-graphs>    


2. create a teamcity-info.xml, the contents are
     <build>
          <statisticValue key="key1" value="342">
          <statisticValue key="key2" value="53">
     </build>

3. run the "graph" build to create the checkout folder in the TeamCity\buildAgent\work folder

4. copy the teamcity-info.xml to the "graph" folder and run the build again

the teamcity-info.xml file disapprears after build, and the result is,

5a. in the build configuration's "statistic" tab, there's no custom graph shows

5b. in the project's "statistic" tab, the custom graph shows, but no statistic data shows in the graph and no legend in the series title column.

i'd like to know,

- whether my procedure is correct; and

- how to specify graph type, like the bar type or line type used in "Success Rate" and "Build duration" graph supplied by TeamCity

thank you.

best regards,
cdgray

0

Please sign in to leave a comment.