NewInstantQuery returns an evaluation query for the given expression at the given time.
(ctx context.Context, q storage.Queryable, opts QueryOpts, qs string, ts time.Time)
| 542 | |
| 543 | // NewInstantQuery returns an evaluation query for the given expression at the given time. |
| 544 | func (ng *Engine) NewInstantQuery(ctx context.Context, q storage.Queryable, opts QueryOpts, qs string, ts time.Time) (Query, error) { |
| 545 | pExpr, qry := ng.newQuery(q, qs, opts, ts, ts, 0*time.Second) |
| 546 | finishQueue, err := ng.queueActive(ctx, qry) |
| 547 | if err != nil { |
| 548 | return nil, err |
| 549 | } |
| 550 | defer finishQueue() |
| 551 | expr, err := ng.parser.ParseExpr(qs) |
| 552 | if err != nil { |
| 553 | return nil, err |
| 554 | } |
| 555 | if err := ng.validateOpts(expr); err != nil { |
| 556 | return nil, err |
| 557 | } |
| 558 | *pExpr, err = PreprocessExpr(expr, ts, ts, 0) |
| 559 | |
| 560 | return qry, err |
| 561 | } |
| 562 | |
| 563 | // NewRangeQuery returns an evaluation query for the given time range and with |
| 564 | // the resolution set by the interval. |