Make Prepare{Instant,Range}Query public

Useful for embedding the query engine.
This commit is contained in:
rojer 2015-04-23 11:52:08 +01:00
parent fa42ed0e7e
commit a0c8b9abbe
3 changed files with 8 additions and 6 deletions

View File

@ -392,7 +392,7 @@ func EvalVectorInstant(node VectorNode, timestamp clientmodel.Timestamp, storage
totalEvalTimer := queryStats.GetTimer(stats.TotalEvalTime).Start()
defer totalEvalTimer.Stop()
closer, err := prepareInstantQuery(node, timestamp, storage, queryStats)
closer, err := PrepareInstantQuery(node, timestamp, storage, queryStats)
if err != nil {
return nil, err
}
@ -412,7 +412,7 @@ func EvalVectorRange(node VectorNode, start clientmodel.Timestamp, end clientmod
matrix := Matrix{}
prepareTimer := queryStats.GetTimer(stats.TotalQueryPreparationTime).Start()
closer, err := prepareRangeQuery(node, start, end, interval, storage, queryStats)
closer, err := PrepareRangeQuery(node, start, end, interval, storage, queryStats)
prepareTimer.Stop()
if err != nil {
return nil, err

View File

@ -166,7 +166,7 @@ func EvalToString(node Node, timestamp clientmodel.Timestamp, format OutputForma
defer totalEvalTimer.Stop()
prepareTimer := queryStats.GetTimer(stats.TotalQueryPreparationTime).Start()
closer, err := prepareInstantQuery(node, timestamp, storage, queryStats)
closer, err := PrepareInstantQuery(node, timestamp, storage, queryStats)
prepareTimer.Stop()
if err != nil {
panic(err)
@ -221,7 +221,7 @@ func EvalToVector(node Node, timestamp clientmodel.Timestamp, storage local.Stor
defer totalEvalTimer.Stop()
prepareTimer := queryStats.GetTimer(stats.TotalQueryPreparationTime).Start()
closer, err := prepareInstantQuery(node, timestamp, storage, queryStats)
closer, err := PrepareInstantQuery(node, timestamp, storage, queryStats)
prepareTimer.Stop()
if err != nil {
panic(err)

View File

@ -120,7 +120,8 @@ func (i *iteratorInitializer) visit(node Node) {
}
}
func prepareInstantQuery(node Node, timestamp clientmodel.Timestamp, storage local.Storage, queryStats *stats.TimerGroup) (local.Preloader, error) {
// PrepareInstantQuery analyzes the query and preloads the necessary time range for each series.
func PrepareInstantQuery(node Node, timestamp clientmodel.Timestamp, storage local.Storage, queryStats *stats.TimerGroup) (local.Preloader, error) {
totalTimer := queryStats.GetTimer(stats.TotalEvalTime)
analyzeTimer := queryStats.GetTimer(stats.QueryAnalysisTime).Start()
@ -167,7 +168,8 @@ func prepareInstantQuery(node Node, timestamp clientmodel.Timestamp, storage loc
return p, nil
}
func prepareRangeQuery(node Node, start clientmodel.Timestamp, end clientmodel.Timestamp, interval time.Duration, storage local.Storage, queryStats *stats.TimerGroup) (local.Preloader, error) {
// PrepareRangeQuery analyzes the query and preloads the necessary time range for each series.
func PrepareRangeQuery(node Node, start clientmodel.Timestamp, end clientmodel.Timestamp, interval time.Duration, storage local.Storage, queryStats *stats.TimerGroup) (local.Preloader, error) {
totalTimer := queryStats.GetTimer(stats.TotalEvalTime)
analyzeTimer := queryStats.GetTimer(stats.QueryAnalysisTime).Start()