
* builds out refactored setup topics * Automatically fix some relrefs with mv-manager Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Use refs for tutorials content which is outside of this repository Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Manually fix complicated relrefs Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * consolidates team sync and db encryption topics * Fix relrefs Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * updates setup index file * Convert TOML to YAML Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Add current alias for new alerting content Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Add current aliases to new setup-grafana and configure-security pages Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Update docs/sources/setup-grafana/configure-grafana/_index.md Co-authored-by: Torkel Ödegaard <torkel@grafana.com> * moves saml docs, updates order in TOC * Manually fix relrefs Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * added usage insights topics, adjusted weights * corrected relrefs * Fix relrefs broken in rebase Signed-off-by: Jack Baldry <jack.baldry@grafana.com> Co-authored-by: Jack Baldry <jack.baldry@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2.4 KiB
aliases | keywords | title | weight | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Examples of template functions | 130 |
Examples of template functions
humanize
Template string { humanize $value }
Input 1234567.0
Expected 1.235M
humanize1024
TemplateString { humanize1024 $value }
Input 1048576.0
Expected 1Mi
humanizeDuration
TemplateString { humanizeDuration $value }
Input 899.99
Expected 14m 59s
humanizePercentage
TemplateString { humanizePercentage $value }
Input 0.1234567
Expected 12.35%
humanizeTimestamp
TemplateString { $value | humanizeTimestamp }
Input 1435065584.128
Expected 2015-06-23 13:19:44.128 +0000 UTC
title
TemplateString { $value | title }
Input aa bb CC
Expected Aa Bb Cc
toUpper
TemplateString { $value | toUpper }
Input aa bb CC
Expected AA BB CC
toLower
TemplateString { $value | toLower }
Input aA bB CC
Expected aa bb cc
match
TemplateString { match "a+" $labels.instance }
Input aa
Expected true
reReplaceAll
TemplateString {{ reReplaceAll "localhost:(.*)" "my.domain:$1" $labels.instance }}
Input localhost:3000
Expected my.domain:3000
graphLink
TemplateString {{ graphLink "{\"expr\": \"up\", \"datasource\": \"gdev-prometheus\"}" }}
Expected /explore?left=["now-1h","now","gdev-prometheus",{"datasource":"gdev-prometheus","expr":"up","instant":false,"range":true}]
tableLink
TemplateString {{ tableLink "{\"expr\": \"up\", \"datasource\": \"gdev-prometheus\"}" }}
Expected /explore?left=["now-1h","now","gdev-prometheus",{"datasource":"gdev-prometheus","expr":"up","instant":true,"range":false}]
args
TemplateString {{define "x"}}{{.arg0}} {{.arg1}}{{end}}{{template "x" (args 1 "2")}}
Expected 1 2
externalURL
TemplateString { externalURL }
Expected http://localhost/path/prefix
pathPrefix
TemplateString { pathPrefix }
Expected /path/prefix