Metrics
Introduction
Metrics are aggregated values on the specified dimensions.
Two types of metrics exist: basic metric fields and custom aggregations.
Metric fields
A metric field is a plain field on which the aggregation operation is pre-defined. For example:
{
...,
"query": {
...,
"metrics": [
"crawl.20210102.count_urls_crawl",
"search_console.period_0.count_clicks"
],
...
}
}crawl.20210102.count_urls_crawlwill count the number of different URLs that were crawledsearch_console.period_0.count_clickswill sum the number of clicks that occurred on the specified dimensions
Here the aggregations are pre-defined, since you can only count the URLs and sum the clicks respectively.
Custom aggregations
For some fields, we require more flexibility and one can choose the aggregation that should be applied. This is done by applying a function to the field:
{
...,
"query": {
...,
"metrics": [
{
"function": "avg",
"args": ["crawl.20210102.depth"]
}
],
...
}
}which will compute the average URL depth on each specified dimension.
Supported custom aggregation functions:
sumavgminmaxweighted_avg(takes two input arguments)countcount_distinctcount_distinct_approxcount_truecount_falsecount_nullcount_eq(takes two input arguments)count_gt(takes two input arguments)count_gte(takes two input arguments)count_lt(takes two input arguments)count_lte(takes two input arguments)
Updated 2 months ago
