(ctx context.Context, q storage.Queryable, opts promql.QueryOpts, root logicalplan.Node, ts time.Time, qs string)
| 136 | } |
| 137 | |
| 138 | func (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 { |
| 140 | qf.engineSwitchQueriesTotal.WithLabelValues(string(Prometheus)).Inc() |
| 141 | } else if engineType == Thanos { |
| 142 | qf.engineSwitchQueriesTotal.WithLabelValues(string(Thanos)).Inc() |
| 143 | } |
| 144 | |
| 145 | if qf.thanosEngine != nil { |
| 146 | res, err := qf.thanosEngine.MakeInstantQueryFromPlan(ctx, q, fromPromQLOpts(opts), root, ts) |
| 147 | if err != nil { |
| 148 | if thanosengine.IsUnimplemented(err) { |
| 149 | // fallback to use prometheus engine |
| 150 | qf.fallbackQueriesTotal.Inc() |
| 151 | goto prom |
| 152 | } |
| 153 | return nil, err |
| 154 | } |
| 155 | return res, nil |
| 156 | } |
| 157 | |
| 158 | prom: |
| 159 | return qf.prometheusEngine.NewInstantQuery(ctx, q, opts, qs, ts) |
| 160 | } |
| 161 | |
| 162 | func (qf *Engine) MakeRangeQueryFromPlan(ctx context.Context, q storage.Queryable, opts promql.QueryOpts, root logicalplan.Node, start time.Time, end time.Time, interval time.Duration, qs string) (promql.Query, error) { |
| 163 | if engineType := GetEngineType(ctx); engineType == Prometheus { |
nothing calls this directly
no test coverage detected