Eden Ridgway's Blog

.Net and Web Development Information

  Home :: Contact :: Syndication  :: Login
  105 Posts :: 1 Stories :: 78 Comments :: 3 Trackbacks

Search

Article Categories

Archives

Post Categories

Development

General

In version 2.7 of CCNet graphs I made some further improvements to the manner in which graphs are configured.  Now any customisations that need to be done are housed in the GraphConfiguration.js file (in the webdashboard\javascript folder).  The logic in the graph generation is now also resilient to problems such as blank or non-numeric data in the custom nodes.

If you want to include custom data in your report you should read the Statistics Publisher Wiki page to get the it included in the report.xml file (which you will find in your artifacts folder for each project).

Configuration Setup

There are 3 areas of configuration, the:
  1. Recent Graphs Tab - the details of which are stored in the _recentGraphConfigurations array of configuration/option objects.  The datasource of each refers to the _recentStatistics object array, that contains up to the last 20 build statistics.
  2. Manner in which Summary Data is calculated - this is stored in the _summaryConfiguration object that contains functions that accept successful and failed build arrays for a day and return an numeric value for each.
  3. Historic Builds Tab - is configured in the same way as the Recent Graphs Tab, except is defined in the _historicGraphConfigurations array and each configuration object uses the _summarisedStatistics datasource.  This datasource contains, the item index, DurationInSeconds, TestsPassed (calculated properties not present in the report.xml file) and the summary data properties defined in _summaryConfiguration.
Example Customisation

Lets say that one wanted to add a complexity graph to the recent and historic tabs, the changes required would be this:
  1. One would edit the _recentGraphConfigurations array and add the following (assuming that the xml element node [in the report.xml file] that contains the data is called AverageComplexity):
    var _recentGraphConfigurations =
        
    [
            
    //... Other configuration objects excluded for brevity
            
    {
                graphName: 
    "Complexity",
                dataSource: _recentStatistics,
                numXTicks: _numberRecentGraphXTicks,
                series: [
                                { name: 
    "Average Complexity", attributeName: "AverageComplexity", color: "blue" }
                              ]
            }
        ]
    ;
  2. Then the manner in which you want to summarise the data on a daily basis needs to be defined in summaryConfiguration.  Note that all the standard summary functions are contained in the QueryFunctions.js file and include methods such as (getLastValue, select, distinct, sum, average, count, min and max).  Say we wanted to display the average complexity value for the day, the configuration would be defined like this:
    var _summaryConfiguration =
        
    {
            
    //Other attributes...
            
    averageComplexity: function(successfulBuilds, failedBuilds) { return average(successfulBuilds, "AverageComplexity") }
        }
    ;
  3. Lastly the summarised data collected by the function above for each day must be configured for the history tab, like this:
    var _historicGraphConfigurations =
        
    [
            
    //Other configuration objects...
            
    {
                graphName: 
    "Complexity",
                dataSource: _summarisedStatistics,
                numXTicks: _numberHistoricGraphXTicks,
                series: [
                                 { name: 
    "Average Complexity", attributeName: "averageComplexity", color: "blue" }
                              ]
            }
        ]
    ;

    Note how the attribute name here corresponds to the attribute name defined in _summaryConfiguration and not the original statistic configuration element.
Hopefully the rest is self explanatory. If something does not make sense or I need to explain the configuration approach in more detail, please leave a message on this post.

Update: 7 July 2007 - Clarified some points of confusion around the source of some of the data.
posted on Monday, May 21, 2007 8:01 AM

Feedback

# re: Adding Custom Graphs to the CruiseControl.Net Statistics Replacement 6/7/2007 2:12 PM Koob
This is great! Very quick overview of history. But I do have a problem. My FxCop results contain 3 assembly dll's. But only the results of the first are show in the graphs. Any tips of how to fix this?
Thanks, Koob.


# re: Adding Custom Graphs to the CruiseControl.Net Statistics Replacement 7/7/2007 1:11 AM Peter Mounce
"One would edit the _recentGraphConfigurations array and add the following (assuming that the xml element node that contains the data is called AverageComplexity):"

The XML element node in ... which file? The CCNET merged report? For example, I have one called log20070706162819Lbuild.ProjectName-51.xml .

I run mbunit tests and ncover over them. My coverage information is getting merged in, from NCoverExplorer's XML report, into an XML element named "coverageReport". My test results are being merged into an element called "report-result" which has a "counter" element beneath it with information in attributes "run-count", "success-count", etc.

If I change (for example) the tests graph config so it reads out of these attributes, then go back to the stats graph page for my project, I don't get new graphs to appear (I currently only see build-duration there). Similarly for coverage, if I change that one's attributeName to "coverageReport" - no new graph.

If I try to find in my XML the string "DurationInSeconds", my editor tells me it's not there. So I assume I'm looking at the wrong XML file (the reports are being kept in my artifacts directory).

Can you suggest what I'm doing wrong, or where I might find the correct files to parse?

# re: Adding Custom Graphs to the CruiseControl.Net Statistics Replacement 7/8/2007 9:19 AM Eden Ridgway
Hi Peter

My apologies for my lack of clarity in my blog post. The Xml file I am referring to is the report.xml file in your artifacts directory (I've updated the post to state this). The DurationInSeconds and TestsPassed attributes are all derived attributes and are not present in the file. However all other attributes are sourced from integration/statistic elements in report.xml.

I will email you to see if we can get your graphs to display.

Eden

# how to display graph in CCNet 7/10/2007 7:26 AM Jeya
Hi,
i am using cruise control 1.2.1. i need agraphical display. i didn't get it. pls help me. what are the steps are following get the graphical display.

# re: Adding Custom Graphs to the CruiseControl.Net Statistics Replacement 7/10/2007 8:02 PM Eden Ridgway
Hi Jeya

Could you please supply me with more detail as to what your problem is.

Thanks

# re: Adding Custom Graphs to the CruiseControl.Net Statistics Replacement 9/4/2007 9:42 PM valery
Hi Eden,
I added your statistics report graph into ccnet build server and it was great to see visual presentation of build results that are usually not attractive in standard ccnet configuration.
I could not find any tabs and now I just have:
Buid report, Buld duration, Test summary, FxCop errors graphs, and two tabels with Build Summary statistics and Build Detailed statistics on one web page.
What was wrong with my installation if I could not have tabs.
I've used this link:
http://www.ridgway.co.za/archive/2007/03/23/180.aspx#InstallationInstructions
and there was no any updated ones. Could you please help with advise.
Thanks in advance
Valery


# re: Adding Custom Graphs to the CruiseControl.Net Statistics Replacement 9/7/2007 6:54 AM Eden Ridgway
Hi Valery

This issue almost certainly has to do with it not finding the JavaScript files on your server. Is it possible that you have some sort of non-standard setup? Do you see JavaScript files at in your CruiseControl.NET\webdashboard\javascript folder (full path usually C:\Program Files\CruiseControl.NET\webdashboard\javascript)? You may want to edit the location of the javascript references in the CruiseControl.NET\webdashboard\xsl\StatisticsGraphs.xsl to ensure that your files are picked up correctly.

Hope that helps.

Regards
Eden

# re: Adding Custom Graphs to the CruiseControl.Net Statistics Replacement 9/12/2007 9:10 AM valery
Hi Eden,

Thank you for reply. Now everything is okay. It was my fault when I took the plug-in I downloaded the old version. Now I got 2.7 it is the last one what I saw.
Any way thanks a lot. Great job. I am going to play around existing features and then will try customize it.
Appreciate your effort.

Thanks again,
Valery


Comments have been closed on this topic.