mirror of
https://github.com/prometheus/prometheus.git
synced 2024-09-19 23:37:31 -07:00
Add hint that the series endpoint is being used to the tsdb.
Currently the series endpoint is paging in all chunks for matched series, which can be rather slow. Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
This commit is contained in:
parent
62bd77bf93
commit
b7c44147f0
|
@ -207,6 +207,13 @@ func (q *blockQuerier) Select(sortSeries bool, hints *storage.SelectHints, ms ..
|
|||
if hints != nil {
|
||||
mint = hints.Start
|
||||
maxt = hints.End
|
||||
if hints.Func == "series" { // The series API does not need any chunks loaded.
|
||||
return &blockSeriesSet{
|
||||
set: base,
|
||||
mint: mint,
|
||||
maxt: maxt,
|
||||
}, nil, nil
|
||||
}
|
||||
}
|
||||
return &blockSeriesSet{
|
||||
set: &populatedChunkSeries{
|
||||
|
|
|
@ -528,10 +528,16 @@ func (api *API) series(r *http.Request) apiFuncResult {
|
|||
}
|
||||
defer q.Close()
|
||||
|
||||
hints := &storage.SelectHints{
|
||||
Start: timestamp.FromTime(start),
|
||||
End: timestamp.FromTime(end),
|
||||
Func: "series", // There is no series function.
|
||||
}
|
||||
|
||||
var sets []storage.SeriesSet
|
||||
var warnings storage.Warnings
|
||||
for _, mset := range matcherSets {
|
||||
s, wrn, err := q.Select(false, nil, mset...)
|
||||
s, wrn, err := q.Select(false, hints, mset...)
|
||||
warnings = append(warnings, wrn...)
|
||||
if err != nil {
|
||||
return apiFuncResult{nil, &apiError{errorExec, err}, warnings, nil}
|
||||
|
|
Loading…
Reference in a new issue