Documentation ¶
Index ¶
Constants ¶
const ( DefaultMessageTitleEmbed = `{{ template "default.title" . }}` DefaultMessageEmbed = `{{ template "default.message" . }}` )
const TemplateForTestsString = `` /* 1571-byte string literal not displayed */
TemplateForTestsString is the template used for unit tests and integration tests. We have it separate from above default template because any tiny change in the template will require updating almost all channel tests (15+ files) and it's very time consuming.
Variables ¶
var (
DefaultFuncs = template.DefaultFuncs
)
var DefaultTemplateString = `` /* 2530-byte string literal not displayed */
var FromGlobs = template.FromGlobs
Functions ¶
func TopTemplates ¶
TopTemplates returns the name of all templates in tmpl that are not executed from a {{ template "name" }} block.
All templates in text/template have a name and some text. In most cases, the name is set when the template is created using template.New(name) and the text is parsed when calling tmpl.Parse(text). This text can include actions for the template called "name", but also define other named templates using either {{ block "name" pipeline }}{{ end }} or {{ define "name" }}{{ end }}. TopTemplates returns the names of all such templates, including the template "name", that are not executed from a {{ template "name" }} block and "name" if name contains text other than just template definitions.
Types ¶
type ExtendedAlert ¶
type ExtendedAlert struct { Status string `json:"status"` Labels KV `json:"labels"` Annotations KV `json:"annotations"` StartsAt time.Time `json:"startsAt"` EndsAt time.Time `json:"endsAt"` GeneratorURL string `json:"generatorURL"` Fingerprint string `json:"fingerprint"` SilenceURL string `json:"silenceURL"` DashboardURL string `json:"dashboardURL"` PanelURL string `json:"panelURL"` Values map[string]float64 `json:"values"` ValueString string `json:"valueString"` // TODO: Remove in Grafana 10 ImageURL string `json:"imageURL,omitempty"` EmbeddedImage string `json:"embeddedImage,omitempty"` }
type ExtendedAlerts ¶
type ExtendedAlerts []ExtendedAlert
func (ExtendedAlerts) Firing ¶
func (as ExtendedAlerts) Firing() []ExtendedAlert
Firing returns the subset of alerts that are firing.
func (ExtendedAlerts) Resolved ¶
func (as ExtendedAlerts) Resolved() []ExtendedAlert
Resolved returns the subset of alerts that are resolved.
type ExtendedData ¶
type ExtendedData struct { Receiver string `json:"receiver"` Status string `json:"status"` Alerts ExtendedAlerts `json:"alerts"` GroupLabels KV `json:"groupLabels"` CommonLabels KV `json:"commonLabels"` CommonAnnotations KV `json:"commonAnnotations"` ExternalURL string `json:"externalURL"` }
func ExtendData ¶
func ExtendData(data *Data, logger log.Logger) *ExtendedData