Documentation
¶
Index ¶
- Variables
- func IsUnimplemented(err error) bool
- func NewRemoteEngine(opts Opts, q storage.Queryable, mint, maxt int64, labelSets []labels.Labels) *remoteEngine
- type AnalyzeOutputNode
- type DistributedEngine
- func (l DistributedEngine) MakeInstantQuery(ctx context.Context, q storage.Queryable, e api.RemoteEndpoints, ...) (promql.Query, error)
- func (l DistributedEngine) MakeInstantQueryFromPlan(ctx context.Context, q storage.Queryable, e api.RemoteEndpoints, ...) (promql.Query, error)
- func (l DistributedEngine) MakeRangeQuery(ctx context.Context, q storage.Queryable, e api.RemoteEndpoints, ...) (promql.Query, error)
- func (l DistributedEngine) MakeRangeQueryFromPlan(ctx context.Context, q storage.Queryable, e api.RemoteEndpoints, ...) (promql.Query, error)
- type Engine
- func (e *Engine) MakeInstantQuery(ctx context.Context, q storage.Queryable, opts *QueryOpts, qs string, ...) (promql.Query, error)
- func (e *Engine) MakeInstantQueryFromPlan(ctx context.Context, q storage.Queryable, opts *QueryOpts, ...) (promql.Query, error)
- func (e *Engine) MakeRangeQuery(ctx context.Context, q storage.Queryable, opts *QueryOpts, qs string, ...) (promql.Query, error)
- func (e *Engine) MakeRangeQueryFromPlan(ctx context.Context, q storage.Queryable, opts *QueryOpts, ...) (promql.Query, error)
- func (e *Engine) NewInstantQuery(ctx context.Context, q storage.Queryable, opts promql.QueryOpts, qs string, ...) (promql.Query, error)
- func (e *Engine) NewRangeQuery(ctx context.Context, q storage.Queryable, opts promql.QueryOpts, qs string, ...) (promql.Query, error)
- type ExplainOutputNode
- type ExplainableQuery
- type Opts
- type Query
- type QueryOpts
- type QueryType
Constants ¶
This section is empty.
Variables ¶
var ( // Duplicate label checking uses a bitmap supporting at most 64 steps. ErrStepsBatchTooLarge = errors.New("'StepsBatch' must not exceed 64") )
Functions ¶
func IsUnimplemented ¶
Types ¶
type AnalyzeOutputNode ¶
type AnalyzeOutputNode struct {
OperatorTelemetry telemetry.OperatorTelemetry `json:"telemetry,omitempty"`
OperatorID *uint64 `json:"operatorId,omitempty"`
Children []*AnalyzeOutputNode `json:"children,omitempty"`
// contains filtered or unexported fields
}
func (*AnalyzeOutputNode) PeakSamples ¶
func (a *AnalyzeOutputNode) PeakSamples() int64
func (*AnalyzeOutputNode) TotalSamples ¶
func (a *AnalyzeOutputNode) TotalSamples() int64
func (*AnalyzeOutputNode) TotalSamplesPerStep ¶
func (a *AnalyzeOutputNode) TotalSamplesPerStep() []int64
type DistributedEngine ¶
type DistributedEngine struct {
// contains filtered or unexported fields
}
func NewDistributedEngine ¶
func NewDistributedEngine(opts Opts) *DistributedEngine
func (DistributedEngine) MakeInstantQuery ¶
func (DistributedEngine) MakeInstantQueryFromPlan ¶
func (DistributedEngine) MakeRangeQuery ¶
func (DistributedEngine) MakeRangeQueryFromPlan ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new query engine with the given options. The query engine will use the storage passed in NewInstantQuery and NewRangeQuery for retrieving data when executing queries.
Storage must support concurrent Select calls and SeriesSet iteration on a shared querier, as well as concurrent decoding of distinct sample iterators returned by that querier. The engine does not serialize storage access.
func NewWithScanners ¶
func NewWithScanners(opts Opts, scanners engstorage.Scanners) *Engine
NewWithScanners creates a new query engine with the given options and storage.Scanners. When executing queries, the engine will create scanner operators using the storage.Scanners and will ignore the Prometheus storage passed in NewInstantQuery and NewRangeQuery. This method is useful when the data being queried does not easily fit into the Prometheus storage model.
func (*Engine) MakeInstantQuery ¶
func (*Engine) MakeInstantQueryFromPlan ¶
func (*Engine) MakeRangeQuery ¶
func (*Engine) MakeRangeQueryFromPlan ¶
type ExplainOutputNode ¶
type ExplainOutputNode struct {
OperatorName string `json:"name,omitempty"`
Children []ExplainOutputNode `json:"children,omitempty"`
}
type ExplainableQuery ¶
type ExplainableQuery interface {
promql.Query
Explain() *ExplainOutputNode
Analyze() *AnalyzeOutputNode
}
type Opts ¶
type Opts struct {
Logger *slog.Logger
Reg prometheus.Registerer
// MaxSamples limits the number of samples loaded by a query.
MaxSamples int
// Timeout limits the duration of query execution.
Timeout time.Duration
// ActiveQueryTracker tracks queries and limits concurrent execution.
ActiveQueryTracker promql.QueryTracker
// LookbackDelta is the maximum age of a sample selected by an instant vector selector.
// Defaults to 5 minutes if not specified.
LookbackDelta time.Duration
// NoStepSubqueryIntervalFn returns the evaluation interval in milliseconds for
// a subquery without an explicit step. Its argument is the range in milliseconds.
NoStepSubqueryIntervalFn func(rangeMillis int64) int64
// EnablePerStepStats enables per-step sample statistics.
EnablePerStepStats bool
// LogicalOptimizers are optimizers that are run if the value is not nil. If it is nil then the default optimizers are run. Default optimizer list is available in the logicalplan package.
LogicalOptimizers []logicalplan.Optimizer
// ExtLookbackDelta specifies what time range to use to determine valid previous sample for extended range functions.
// Defaults to 1 hour if not specified.
ExtLookbackDelta time.Duration
// DecodingConcurrency is the maximum number of goroutines that can be used to decode samples. Defaults to GOMAXPROCS / 2.
DecodingConcurrency int
// SelectorBatchSize specifies the maximum number of samples to be returned by selectors in a single batch.
SelectorBatchSize int64
// EnableExperimentalFunctions enables parsing of experimental PromQL functions
// and aggregations. Defaults to false.
EnableExperimentalFunctions bool
// EnableXFunctions enables custom xRate, xIncrease and xDelta functions.
// This will default to false.
EnableXFunctions bool
// EnableAnalysis enables query analysis.
EnableAnalysis bool
// The Prometheus engine has internal check for duplicate labels produced by functions, aggregations or binary operators.
// This check can produce false positives when querying time-series data which does not conform to the Prometheus data model,
// and can be disabled if it leads to false positives.
DisableDuplicateLabelChecks bool
}
Opts configures the query engine. Only options supported by this engine are exposed.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) Analyze ¶
func (q *Query) Analyze() *AnalyzeOutputNode
func (*Query) Explain ¶
func (q *Query) Explain() *ExplainOutputNode
Explain returns human-readable explanation of the created executor.
type QueryOpts ¶
type QueryOpts struct {
// These values are used to implement promql.QueryOpts, they have weird "Param" suffix because
// they are accessed by methods of the same name.
LookbackDeltaParam time.Duration
EnablePerStepStatsParam bool
// DecodingConcurrency can be used to override the DecodingConcurrency engine setting.
DecodingConcurrency int
// SelectorBatchSize can be used to override the SelectorBatchSize engine setting.
SelectorBatchSize int64
// LogicalOptimizers can be used to override the LogicalOptimizers engine setting.
LogicalOptimizers []logicalplan.Optimizer
}
QueryOpts implements promql.QueryOpts but allows to override more engine default options.
func (QueryOpts) EnablePerStepStats ¶
func (QueryOpts) LookbackDelta ¶
func (QueryOpts) UseStartTimestamps ¶
UseStartTimestamps disables unsupported start-timestamp evaluation.