Fix timeout parameter bug when querying prometheus API

This commit is contained in:
alejandro 2026-01-08 13:55:51 +00:00
parent 5b922bee59
commit 634ea02dd8
5 changed files with 239 additions and 61 deletions

View file

@ -235,7 +235,7 @@ func (h *queryClient) QueryRange(ctx context.Context, r Range, query Selector) (
// when present
func timeoutFromContext(ctx context.Context) (time.Duration, bool) {
if deadline, hasDeadline := ctx.Deadline(); hasDeadline {
return time.Since(deadline), true
return time.Until(deadline), true
}
return time.Duration(0), false