Provides Go templating utilities for expanding alert labels/annotations with query results, supporting text and HTML output with custom template functions and label sorting.
// Source: https://github.com/SigNoz/signoz | License: MIT | Copyright 2020-present SigNoz Inc
// Provided via justclaw.it.com; keep this notice with the code.
package ruletypes
import (
"bytes"
"context"
"fmt"
"math"
"net/url"
"regexp"
"sort"
"strings"
"time"
"unicode"
"github.com/SigNoz/signoz/pkg/errors"
htmltpl "html/template"
texttpl "text/template"
"golang.org/x/text/cases"
)
// this file contains all the methods and structs
// related to go templating in rule labels and annotations
type tmplQueryRecord struct {
Labels map[string]string
Value float64
Threshold float64
}
type tmplQueryResults []*tmplQueryRecord
type tmplQueryResultsByLabelSorter struct {
results tmplQueryResults
by string
}
func (q tmplQueryResultsByLabelSorter) Len() int {
retu
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key