Metrics

Metrics can be defined inside any .farm-file and must contain a unique name and a source configuration, which describes how to measure the metric.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
  "metrics": {
     "all_html_files": {
        "source": {
          "type": "html_file_count"
        }
     },
     "doc_html_files": {
        "source": {
          "type": "html_file_count",
          "path": "docs/"
        }
     }
  }
}

Metrics must be defined in the metrics section, which stores a dictionary for specific metrics (line 2).

Each metric must be registered as element of this dictionary with an unique name (line 3 and 8). The name must be unique in all used .farm-files.

Parameters

A metric can contain multiple parameters, which can be simple numbers or strings or list and complex dictionaries.

description

A description can be set to simplify the understanding and maintenance of your metrics for other users.

{
  "metrics": {
     "my_metric": {
        "description": "An awesome metric to measure awesome stuff",
        "source": {
          "type": "static"
        }
     }
  }
}

source

source is the most important section of a metric, as it defines what gets measured and how.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "metrics": {
     "doc_html_files": {
        "source": {
          "type": "html_file_count",
          "path": "docs/"
        }
     }
  }
}

source must be a dictionary and contain at least the parameter type (line 5).

type must be a string and reference an existing and loaded source type.

The used source type defines what other parameters can be set and are used during measurement. These parameters differs a lot between the different source types. So take a look into the related source type documentation.

However, there aren’t any checks, if additional parameters are really supported by the referenced source type. So you are free to set as many parameters as you like.