MCPcopy Index your code
hub / github.com/cortexproject/cortex / NewRangeQuery

Method NewRangeQuery

pkg/engine/engine.go:114–136  ·  view source on GitHub ↗
(ctx context.Context, q storage.Queryable, opts promql.QueryOpts, qs string, start, end time.Time, interval time.Duration)

Source from the content-addressed store, hash-verified

112}
113
114func (qf *Engine) NewRangeQuery(ctx context.Context, q storage.Queryable, opts promql.QueryOpts, qs string, start, end time.Time, interval time.Duration) (promql.Query, error) {
115 if engineType := GetEngineType(ctx); engineType == Prometheus {
116 qf.engineSwitchQueriesTotal.WithLabelValues(string(Prometheus)).Inc()
117 goto prom
118 } else if engineType == Thanos {
119 qf.engineSwitchQueriesTotal.WithLabelValues(string(Thanos)).Inc()
120 }
121 if qf.thanosEngine != nil {
122 res, err := qf.thanosEngine.MakeRangeQuery(ctx, q, fromPromQLOpts(opts), qs, start, end, interval)
123 if err != nil {
124 if thanosengine.IsUnimplemented(err) {
125 // fallback to use prometheus engine
126 qf.fallbackQueriesTotal.Inc()
127 goto prom
128 }
129 return nil, err
130 }
131 return res, nil
132 }
133
134prom:
135 return qf.prometheusEngine.NewRangeQuery(ctx, q, opts, qs, start, end, interval)
136}
137
138func (qf *Engine) MakeInstantQueryFromPlan(ctx context.Context, q storage.Queryable, opts promql.QueryOpts, root logicalplan.Node, ts time.Time, qs string) (promql.Query, error) {
139 if engineType := GetEngineType(ctx); engineType == Prometheus {

Calls 3

GetEngineTypeFunction · 0.85
fromPromQLOptsFunction · 0.85
IncMethod · 0.45