mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08: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 {
|
if hints != nil {
|
||||||
mint = hints.Start
|
mint = hints.Start
|
||||||
maxt = hints.End
|
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{
|
return &blockSeriesSet{
|
||||||
set: &populatedChunkSeries{
|
set: &populatedChunkSeries{
|
||||||
|
|
|
@ -528,10 +528,16 @@ func (api *API) series(r *http.Request) apiFuncResult {
|
||||||
}
|
}
|
||||||
defer q.Close()
|
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 sets []storage.SeriesSet
|
||||||
var warnings storage.Warnings
|
var warnings storage.Warnings
|
||||||
for _, mset := range matcherSets {
|
for _, mset := range matcherSets {
|
||||||
s, wrn, err := q.Select(false, nil, mset...)
|
s, wrn, err := q.Select(false, hints, mset...)
|
||||||
warnings = append(warnings, wrn...)
|
warnings = append(warnings, wrn...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return apiFuncResult{nil, &apiError{errorExec, err}, warnings, nil}
|
return apiFuncResult{nil, &apiError{errorExec, err}, warnings, nil}
|
||||||
|
|
Loading…
Reference in a new issue