From 5a8ebf0c4418df79db75bc6582085903b8d5d854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Fri, 15 Aug 2025 23:55:24 +0200 Subject: [PATCH] collector: support sub-second timeout values. (#2181) --- internal/httphandler/httphandler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/httphandler/httphandler.go b/internal/httphandler/httphandler.go index 058ebccc..53541acc 100644 --- a/internal/httphandler/httphandler.go +++ b/internal/httphandler/httphandler.go @@ -117,7 +117,7 @@ func (c *MetricsHTTPHandler) getScrapeTimeout(logger *slog.Logger, r *http.Reque timeoutSeconds -= c.options.TimeoutMargin - return time.Duration(timeoutSeconds) * time.Second + return time.Duration(timeoutSeconds*1e9) * time.Nanosecond } func (c *MetricsHTTPHandler) handlerFactory(logger *slog.Logger, scrapeTimeout time.Duration, requestedCollectors []string) (http.Handler, error) {