Generator Functions

series(metric, source, options={})

At the lowest level of a composite’s definition are a set of raw metrics. These are accessed through the special function series() that takes two arguments, a metric name and a source value wrapped in double-quotes (“). Either the metric name and/or the source value may contain the wildcard character:

series("foo.bar.*", "prod.*")

A dynamic source may be specified for the source value with the percent symbol i.e. “%”. This indicates that the source will be specified at the time the composite metric is loaded into a template instrument or dashboard:

series("foo.bar.*", "%")

As calls to series() are required in every composite definition a special shorthand notation s() will be an alias to the series() function:

sum(s("foo.bar.*", "prod.*"))

The options map may be included with any of the following keys:

  • function - Specifies which summary statistic should be used. Accepted values are: min, max, mean, sum, count. The default function, if not specified, is mean.
  • period - Specifies the interval to which returned measurements should be summarized. All measurements within each period are summarized to a single measurement and the measure_time is floored to the period. This allows you to specify granularity that is not available at the standard rollup resolutions (1s, 60s, 900s, 3600s).
sum(s("foo.bar.*", "prod.*", { period:"100", function:"mean" }))