Skip to content

Commit 4aeabbc

Browse files
committed
feat(webhook): Improve instrumentation for certificate rotation
1 parent 44c93c9 commit 4aeabbc

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

  • crates/stackable-webhook/src

crates/stackable-webhook/src/lib.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,21 @@ impl WebhookServer {
187187
// run associated function consumes self. This in turn means that when the receiver is
188188
// polled, it will return `Ok(Ready(None))`, which will cause this while loop to break
189189
// and the future to complete.
190-
while let Some(cert) = cert_rx.recv().await {
190+
while let Some(certificate) = cert_rx.recv().await {
191+
// NOTE (@Techassi): There are currently NO semantic conventions for X509 certificates
192+
// and as such, these are pretty much made up and potentially not ideal.
193+
#[rustfmt::skip]
194+
tracing::info!(
195+
x509.not_before = certificate.tbs_certificate.validity.not_before.to_string(),
196+
x509.not_after = certificate.tbs_certificate.validity.not_after.to_string(),
197+
x509.serial_number = certificate.tbs_certificate.serial_number.to_string(),
198+
x509.subject = certificate.tbs_certificate.subject.to_string(),
199+
x509.issuer = certificate.tbs_certificate.issuer.to_string(),
200+
"rotate certificate for registered webhooks"
201+
);
202+
191203
// The caBundle needs to be provided as a base64-encoded PEM envelope.
192-
let ca_bundle = cert
204+
let ca_bundle = certificate
193205
.to_pem(LineEnding::LF)
194206
.context(EncodeCertificateAuthorityAsPemSnafu)?;
195207
let ca_bundle = ByteString(ca_bundle.as_bytes().to_vec());

0 commit comments

Comments
 (0)