mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 09:47:54 +00:00
fix seriesQuery parameters for managed prometheus in gcp
This commit is contained in:
parent
9008b12a01
commit
458e5958fb
2 changed files with 4 additions and 4 deletions
|
|
@ -238,7 +238,7 @@ type selectorSeries struct {
|
|||
|
||||
func (l *cachingMetricsLister) updateMetrics() error {
|
||||
startTime := pmodel.Now().Add(-1 * l.maxAge)
|
||||
|
||||
endTime := pmodel.Now()
|
||||
// don't do duplicate queries when it's just the matchers that change
|
||||
seriesCacheByQuery := make(map[prom.Selector][]prom.Series)
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ func (l *cachingMetricsLister) updateMetrics() 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{Start: startTime, End: endTime}, sel)
|
||||
if err != nil {
|
||||
errs <- fmt.Errorf("unable to fetch metrics for query %q: %v", sel, err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ func (l *basicMetricLister) ListAllMetrics() (MetricUpdateResult, error) {
|
|||
}
|
||||
|
||||
startTime := pmodel.Now().Add(-1 * l.lookback)
|
||||
|
||||
endTime := pmodel.Now()
|
||||
// these can take a while on large clusters, so launch in parallel
|
||||
// and don't duplicate
|
||||
selectors := make(map[prom.Selector]struct{})
|
||||
|
|
@ -100,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{Start: startTime, End: endTime}, sel)
|
||||
if err != nil {
|
||||
errs <- fmt.Errorf("unable to fetch metrics for query %q: %v", sel, err)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue