collector: support sub-second timeout values. (#2181)

This commit is contained in:
Jan-Otto Kröpke
2025-08-15 23:55:24 +02:00
committed by GitHub
parent acbabb926d
commit 5a8ebf0c44

View File

@@ -117,7 +117,7 @@ func (c *MetricsHTTPHandler) getScrapeTimeout(logger *slog.Logger, r *http.Reque
timeoutSeconds -= c.options.TimeoutMargin 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) { func (c *MetricsHTTPHandler) handlerFactory(logger *slog.Logger, scrapeTimeout time.Duration, requestedCollectors []string) (http.Handler, error) {