ribbybibby / ssl_exporter

Exports Prometheus metrics for TLS certificates
Apache License 2.0
525 stars 99 forks source link

Improve error logging by including the target address in the log #45

Closed rgl closed 4 years ago

rgl commented 4 years ago

The errors messages should include the target address.

Currently, the error message are not very useful to troubleshoot the problems:

dial tcp 1.2.3.4:443: i/o timeout
remote error: tls: bad certificate

All the errors messages should have a prefix of the target address, for example, when requesting as http://127.0.0.1:9219/probe?target=example.com%3A443, the error messages should have a common prefix:

target example.com:443 failed: dial tcp 1.2.3.4:443: i/o timeout
target example.com:443 failed: remote error: tls: bad certificate
ribbybibby commented 4 years ago

Yep, agreed, the logs could definitely be better.

ribbybibby commented 4 years ago

https://github.com/ribbybibby/ssl_exporter/pull/49