certinel
certinel copied to clipboard
Report metrics for watched certificate not before/not after times
Providing metrics for the watched certificate not before/not after times would be helpful for alerts to ensure certificates are being renewed and reloaded by the application.
This functionality could be implemented outside outside of this library using the existing API (i.e. just calling GetCertificate), but it would be nice if applications could get these metrics automatically just by leveraging certinel.
Is something like this what you had in mind?
# HELP certificate_not_after_milliseconds Measures the not after timestamp of the loaded certificate
# TYPE certificate_not_after_milliseconds gauge
certificate_not_after_milliseconds{certificate_serial="65537",otel_scope_name="github.com/cloudflare/certinel/fswatcher",otel_scope_version="0.4.1"} 1.716224463e+12
# HELP certificate_not_before_milliseconds Measures the not before timestamp of the loaded certificate
# TYPE certificate_not_before_milliseconds gauge
certificate_not_before_milliseconds{certificate_serial="65537",otel_scope_name="github.com/cloudflare/certinel/fswatcher",otel_scope_version="0.4.1"} 1.716224463e+12
Looks great. One other request is to include the cert's file path as a label, to make it easy to identify different certs when an application uses multiple.