Trend monitoring

Trend Monitoring



Introduction

VBDepend lets create trend charts. Trend charts are made of trend metrics values logged over time at analysis time. More than 50 trend metrics are available per default and it is easy to create your own trend metrics.



Trend charts are displayed on the VBDepend dahsboard. Some trend charts are available per default to show:

  • Lines of Code
  • Number of Code Rules Violated and number of Code Rules Violations
  • Max and Average values for various Code Quality Metrics
  • Third-Party Usage
Trend charts can be customized and it is easy to create your own trend charts to show default trend metrics and/or custom trend metrics.



For all trending related operations, a trend menu is available.





▲▲ Go to Top ▲▲
Trend Metrics

To list the default trend metrics, look at the Queries and Rules Explorer panel and select the group named Trend Metrics.



If trend metrics are listed in the code queries panel, it is because a trend metric is a CQLinq code query. It is a particular code query:
  • A trend metric is a code query that returns a scalar. Hence trend metrics query often use LINQ aggregate operators that returns a scalar. This includes operators like Count() Sum() Average() Min() Max() ...
  • The header of a code query is a comment line formatted this way // <TrendMetric Name="Metric Name" Unit="Metric Unit Name" />
For example here is the # Lines of Code trend metric code query:



Since a trend metric is a code query, it is easy to create your own trend metrics or modify existing ones. For example here is a code query that counts the numbers of types inherenting from Poco.Exception:



There are six default trend metrics that are not code queries. They relates to the number of code rules violates and the number of code rules violations:



Trend metrics are logged at analysis time as explained in the section Logging Trend Metrics.

▲▲ Go to Top ▲▲
Trend Charts

The Create or Edit trend charts dialog lets define all trend charts properties. The list of trend metrics series is available and checking a serie lets visualize it on the trend chart. A serie appearance can be customized, this includes:
  • The color of the serie
  • If the serie is displayed as a line or as an area
  • Defining the serie scale. The scale setting is useful to adjust several series scales to compare them on the same trend chart.




▲▲ Go to Top ▲▲

Reporting Trend Charts

In the picture above we can see a tick box labelled: Show this trend chart in report. Trend charts can indeed been displayed in report.

For that the tick box VBDepend Project Properties panel > Report tab > Use standard report ticked > Trend Charts must be ticked.





▲▲ Go to Top ▲▲

Logging Trend Metrics

Trend metrics values are logged at analysis time. By running analysis every days, a series of trend metric values is built.

Settings related to log of trend metrics values are available, both in the VBDepend Options > Trend section, and in the VBDepend Project Properties > Analysis > Trend Metrics Log section. If settings in Project Properties are set, they override the global settings defined in the Options.

Trend metrics log settings includes:
  • The frequency of logs, like at most once a day or a week
  • The definition of a label for each log, that represents the version of the code base analysed. In the trend chart screenshot above you can see that this version label is displayed on the trend charts on the timeline X axis.
  • The folder where files that contain trend metrics values are persisted. To avoid too large files, a file is created for each year.


Notice that no matter the trend metrics log settings, using the VBDepend.Console.exe command line parameter /LogTrendMetrics will force trend metrics log during the analysis.

▲▲ Go to Top ▲▲