Documentation
¶
Index ¶
- Constants
- Variables
- func BaseTemplateFuncs() template.FuncMap
- func EntryTemplateLabels(entry LogEntry) map[string]string
- func ExecuteLineFormatTemplate(tpl *template.Template, bind func(LogEntry), entry LogEntry) (string, error)
- func GetDuration(script any) (time.Duration, error)
- func GetStrSelector(script any) *logql_parser.StrSelector
- func JsonPathParamToArray(param string) ([]string, error)
- func JsonPathParamToTypedArray(param string) ([]string, error)
- func PrepareLineFormatTemplate(templateStr string) (*template.Template, func(LogEntry), error)
- func TamePanic(out chan []LogEntry)
- type ClickhouseGetterPlanner
- func (c *ClickhouseGetterPlanner) IsMatrix() bool
- func (c *ClickhouseGetterPlanner) Process(ctx *PlannerContext, ch chan []LogEntry) (chan []LogEntry, error)
- func (c *ClickhouseGetterPlanner) Scan(ctx *PlannerContext, rows *sql.Rows, res chan []LogEntry)
- func (c *ClickhouseGetterPlanner) ScanMatrix(ctx *PlannerContext, rows *sql.Rows, res chan []LogEntry)
- type GenericTraceRequestProcessor
- type LogEntry
- type NotSupportedError
- type PlannerContext
- type RandomFilter
- type RequestPlanner
- type RequestProcessor
- type RequestProcessorChain
- type SQLRequestPlanner
- type TraceRequestProcessor
Constants ¶
const ( ErrorLabel = "__error__" ErrorDetailsLabel = "__error_details__" )
Synthetic labels injected onto a log entry when a parser stage fails to process its line, mirroring Loki's behavior. They are ordinary labels and so are filterable with the usual label filters (e.g. `| __error__=""`).
const ( JSONParserErr = "JSONParserErr" LogfmtParserErr = "LogfmtParserErr" )
Values set in ErrorLabel, one per parser kind.
const SAMPLES_TYPE_BOTH = 0
const SAMPLES_TYPE_LOGS = 1
const SAMPLES_TYPE_METRICS = 2
Variables ¶
var ParserErrorType = map[string]string{ "json": JSONParserErr, "logfmt": LogfmtParserErr, }
ParserErrorType maps a parser op name to the ErrorLabel value it emits on failure. Parsers absent from the map (e.g. regexp) do not flag runtime errors.
Functions ¶
func BaseTemplateFuncs ¶ added in v4.3.0
BaseTemplateFuncs returns the shared LogQL template functions used by line_format and label_format, excluding per-entry builtins such as __line__ and __timestamp__.
func EntryTemplateLabels ¶ added in v4.3.0
EntryTemplateLabels returns label values available to line_format templates.
func ExecuteLineFormatTemplate ¶ added in v4.3.0
func ExecuteLineFormatTemplate(tpl *template.Template, bind func(LogEntry), entry LogEntry) (string, error)
ExecuteLineFormatTemplate renders a parsed template for a single log entry.
func GetStrSelector ¶
func GetStrSelector(script any) *logql_parser.StrSelector
func JsonPathParamToArray ¶
func PrepareLineFormatTemplate ¶ added in v4.3.0
PrepareLineFormatTemplate parses a line_format/label_format template and returns a binder that must be called before each Execute with the current log entry.
Types ¶
type ClickhouseGetterPlanner ¶
type ClickhouseGetterPlanner struct {
ClickhouseRequestPlanner SQLRequestPlanner
Matrix bool
}
func (*ClickhouseGetterPlanner) IsMatrix ¶
func (c *ClickhouseGetterPlanner) IsMatrix() bool
func (*ClickhouseGetterPlanner) Process ¶
func (c *ClickhouseGetterPlanner) Process(ctx *PlannerContext, ch chan []LogEntry) (chan []LogEntry, error)
func (*ClickhouseGetterPlanner) Scan ¶
func (c *ClickhouseGetterPlanner) Scan(ctx *PlannerContext, rows *sql.Rows, res chan []LogEntry)
func (*ClickhouseGetterPlanner) ScanMatrix ¶
func (c *ClickhouseGetterPlanner) ScanMatrix(ctx *PlannerContext, rows *sql.Rows, res chan []LogEntry)
type GenericTraceRequestProcessor ¶
type GenericTraceRequestProcessor[T any] interface { Process(*PlannerContext) (chan []T, error) }
type NotSupportedError ¶
type NotSupportedError struct {
Msg string
}
func (*NotSupportedError) Error ¶
func (n *NotSupportedError) Error() string
type PlannerContext ¶
type PlannerContext struct {
IsCluster bool
From time.Time
To time.Time
OrderASC bool
Limit int64
Offset time.Duration
TimeSeriesGinTableName string
TimeSeriesGinDistTableName string
SamplesTableName string
SamplesDistTableName string
TimeSeriesTableName string
TimeSeriesDistTableName string
Metrics15sTableName string
Metrics15sDistTableName string
PatternsTable string
TracesAttrsTable string
TracesAttrsDistTable string
TracesTable string
TracesDistTable string
TracesKVTable string
TracesKVDistTable string
ProfilesSeriesGinTable string
ProfilesSeriesGinDistTable string
ProfilesTable string
ProfilesDistTable string
ProfilesSeriesTable string
ProfilesSeriesDistTable string
PatternsDistTable string
UseCache bool
Ctx context.Context
CHDb model.ISqlxDB
CHFinalize bool
CHSqlCtx *sql.Ctx
DDBSamplesTable string
DDBTSTable string
CancelCtx context.CancelFunc
Step time.Duration
DeleteID string
Type uint8
RandomFilter RandomFilter
CachedTraceIds []string
VersionInfo dbversion.VersionInfo
// TracesIntrinsicWhere holds extra WHERE conditions for the tempo_traces table
// (e.g., nestedSetParent < 0 → parent_id = ”).
TracesIntrinsicWhere []sql.SQLCondition
// contains filtered or unexported fields
}
func (*PlannerContext) Id ¶
func (p *PlannerContext) Id() int
type RandomFilter ¶
type RequestPlanner ¶
type RequestPlanner interface {
Process(cnain RequestProcessorChain) (RequestProcessorChain, error)
}
type RequestProcessor ¶
type RequestProcessor interface {
IsMatrix() bool
Process(*PlannerContext, chan []LogEntry) (chan []LogEntry, error)
}
type RequestProcessorChain ¶
type RequestProcessorChain []RequestProcessor
type SQLRequestPlanner ¶
type SQLRequestPlanner interface {
Process(ctx *PlannerContext) (sql.ISelect, error)
}
type TraceRequestProcessor ¶
type TraceRequestProcessor interface {
Process(*PlannerContext) (chan []model.TraceInfo, error)
}