mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-19 19:19:04 +02:00
log: open the event log lazily, bound close, keep the service running, structured messages (#2734)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -135,7 +135,10 @@ func (c *MetricsHTTPHandler) getScrapeTimeout(logger *slog.Logger, r *http.Reque
|
||||
// Includes values too large for a float64, which ParseFloat reports as an error.
|
||||
timeout = MaxScrapeTimeout
|
||||
case err != nil, math.IsNaN(seconds), seconds <= 0:
|
||||
logger.WarnContext(r.Context(), fmt.Sprintf("Invalid X-Prometheus-Scrape-Timeout-Seconds: %q. Defaulting timeout to %s", v, defaultScrapeTimeout))
|
||||
logger.LogAttrs(r.Context(), slog.LevelWarn, "invalid X-Prometheus-Scrape-Timeout-Seconds header, using the default timeout",
|
||||
slog.String("value", v),
|
||||
slog.Duration("timeout", defaultScrapeTimeout),
|
||||
)
|
||||
default:
|
||||
timeout = toDuration(seconds)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user