Skip to content

Commit

Permalink
http: Prevent logging confusing error message
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Adrian Serrano <[email protected]>
  • Loading branch information
adriansr committed Jun 2, 2023
1 parent 0b04674 commit 0dc9f1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion prober/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 0dc9f1b

Please sign in to comment.