From 617a4e52dba5e5a7bb17d6f39694e7334bbfb8e1 Mon Sep 17 00:00:00 2001 From: Adrian Serrano Date: Fri, 14 Apr 2023 15:35:23 +0200 Subject: [PATCH] http: Prevent logging confusing error message When FailIfNotSSL is set, the error message: > Final request was not over SSL is logged even if a previous error has prevented the request to complete, for example when it fails due to a timeout or connection error. This updates the logic around the log message so it's printed when an otherwise successful request is not performed over SSL and that causes the probe to fail. --- prober/http.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prober/http.go b/prober/http.go index 5e452cd9..13b36eff 100644 --- a/prober/http.go +++ b/prober/http.go @@ -647,7 +647,7 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr level.Error(logger).Log("msg", "Final request was over SSL") success = false } - } else if httpConfig.FailIfNotSSL { + } else if httpConfig.FailIfNotSSL && success { level.Error(logger).Log("msg", "Final request was not over SSL") success = false }