mirror of https://github.com/prometheus/prometheus
Fix usages of parser.Statement
Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>pull/6744/head
parent
2f1113479f
commit
4a4817a444
|
@ -125,8 +125,8 @@ type Query interface {
|
||||||
Exec(ctx context.Context) *Result
|
Exec(ctx context.Context) *Result
|
||||||
// Close recovers memory used by the query result.
|
// Close recovers memory used by the query result.
|
||||||
Close()
|
Close()
|
||||||
// Statement returns the parsed statement of the query.
|
// parser.Statement returns the parsed statement of the query.
|
||||||
Statement() Statement
|
Statement() parser.Statement
|
||||||
// Stats returns statistics about the lifetime of the query.
|
// Stats returns statistics about the lifetime of the query.
|
||||||
Stats() *stats.QueryTimers
|
Stats() *stats.QueryTimers
|
||||||
// Cancel signals that a running query execution should be aborted.
|
// Cancel signals that a running query execution should be aborted.
|
||||||
|
@ -139,8 +139,8 @@ type query struct {
|
||||||
queryable storage.Queryable
|
queryable storage.Queryable
|
||||||
// The original query string.
|
// The original query string.
|
||||||
q string
|
q string
|
||||||
// Statement of the parsed query.
|
// parser.Statement of the parsed query.
|
||||||
stmt Statement
|
stmt parser.Statement
|
||||||
// Timer stats for the query execution.
|
// Timer stats for the query execution.
|
||||||
stats *stats.QueryTimers
|
stats *stats.QueryTimers
|
||||||
// Result matrix for reuse.
|
// Result matrix for reuse.
|
||||||
|
@ -156,8 +156,8 @@ type queryCtx int
|
||||||
|
|
||||||
var queryOrigin queryCtx
|
var queryOrigin queryCtx
|
||||||
|
|
||||||
// Statement implements the Query interface.
|
// parser.Statement implements the Query interface.
|
||||||
func (q *query) Statement() Statement {
|
func (q *query) Statement() parser.Statement {
|
||||||
return q.stmt
|
return q.stmt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +444,7 @@ func (ng *Engine) exec(ctx context.Context, q *query) (v parser.Value, w storage
|
||||||
if l := ng.queryLogger; l != nil {
|
if l := ng.queryLogger; l != nil {
|
||||||
params := make(map[string]interface{}, 4)
|
params := make(map[string]interface{}, 4)
|
||||||
params["query"] = q.q
|
params["query"] = q.q
|
||||||
if eq, ok := q.Statement().(*EvalStmt); ok {
|
if eq, ok := q.parser.Statement().(*EvalStmt); ok {
|
||||||
params["start"] = formatDate(eq.Start)
|
params["start"] = formatDate(eq.Start)
|
||||||
params["end"] = formatDate(eq.End)
|
params["end"] = formatDate(eq.End)
|
||||||
// The step provided by the user is in seconds.
|
// The step provided by the user is in seconds.
|
||||||
|
@ -497,14 +497,14 @@ func (ng *Engine) exec(ctx context.Context, q *query) (v parser.Value, w storage
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
switch s := q.Statement().(type) {
|
switch s := q.parser.Statement().(type) {
|
||||||
case *EvalStmt:
|
case *EvalStmt:
|
||||||
return ng.execEvalStmt(ctx, q, s)
|
return ng.execEvalStmt(ctx, q, s)
|
||||||
case testStmt:
|
case testStmt:
|
||||||
return nil, nil, s(ctx)
|
return nil, nil, s(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
panic(errors.Errorf("promql.Engine.exec: unhandled statement of type %T", q.Statement()))
|
panic(errors.Errorf("promql.Engine.exec: unhandled statement of type %T", q.parser.Statement()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func timeMilliseconds(t time.Time) int64 {
|
func timeMilliseconds(t time.Time) int64 {
|
||||||
|
|
Loading…
Reference in New Issue