Template reference
The primary data structure for dealing with time series data is the sample, defined as:
The metric name of the sample is encoded in a special label in the Labels
map.
[]sample
means a list of samples.
interface{}
in Go is similar to a void pointer in C.
If functions are used in a pipeline, the pipeline value is passed as the last argument.
first
, label
and value
are intended to make query results easily usable in pipelines.
Numbers
Humanizing functions are intended to produce reasonable output for consumption by humans, and are not guaranteed to return the same results between Prometheus versions.
Others
Each of the types of templates provide different information that can be used to parameterize templates, and have a few other differences.
Console templates
Consoles are exposed on /consoles/
, and sourced from the directory pointed to by the -web.console.templates
flag.
Console templates are rendered with , which provides auto-escaping. To bypass the auto-escaping use the safe*
functions.,
URL parameters are available as a map in .Params
. To access multiple URL parameters by the same name, .RawParams
is a map of the list values for each parameter. The URL path is available in .Path
, excluding the prefix. The globally configured external labels are available as .ExternalLabels
. There are also convenience variables for all four: $rawParams
, $params
, $path
, and $externalLabels
.
Consoles also have access to all the templates defined with {{define "templateName"}}...{{end}}
found in *.lib
files in the directory pointed to by the -web.console.libraries
flag. As this is a shared namespace, take care to avoid clashes with other users. Template names beginning with prom
, _prom
, and __
are reserved for use by Prometheus, as are the functions listed above.