add endTime variable for promeClient.Series api

Signed-off-by: 屈骏 <qujun@tiduyun.com>
This commit is contained in:
屈骏 2020-07-22 10:51:08 +08:00
parent 6e05ab938e
commit 5e169f5b0d
3 changed files with 6 additions and 3 deletions

View file

@ -84,6 +84,7 @@ func (l *basicMetricLister) ListAllMetrics() (MetricUpdateResult, error) {
}
startTime := pmodel.Now().Add(-1 * l.lookback)
endTime := pmodel.Now().Add(1 * l.lookback)
// these can take a while on large clusters, so launch in parallel
// and don't duplicate
@ -99,7 +100,7 @@ func (l *basicMetricLister) ListAllMetrics() (MetricUpdateResult, error) {
}
selectors[sel] = struct{}{}
go func() {
series, err := l.promClient.Series(context.TODO(), pmodel.Interval{startTime, 0}, sel)
series, err := l.promClient.Series(context.TODO(), pmodel.Interval{startTime, endTime}, sel)
if err != nil {
errs <- fmt.Errorf("unable to fetch metrics for query %q: %v", sel, err)
return