Skip to content

feat(certmanager): register certificate expiry metrics#102

Draft
AntiD2ta wants to merge 1 commit intouse-go-certmanagerfrom
use-go-certmanager-metrics
Draft

feat(certmanager): register certificate expiry metrics#102
AntiD2ta wants to merge 1 commit intouse-go-certmanagerfrom
use-go-certmanager-metrics

Conversation

@AntiD2ta
Copy link
Copy Markdown
Contributor

Summary

Adopts go-certmanager PR #16's new metrics API. Threads the existing Dirk monitor into both certificate manager constructors so certmanager_certificate_not_{after,before}_seconds gauges are exposed under name="dirk" with role="server" and role="client" labels.

Dirk uses the same cert material for both its inbound (server) identity and peer-outbound (client) identity, so both managers use name="dirk"; the role label is the only differentiator.

Changes

  • main.go:
    • startCertManager now accepts a metrics.Service and calls WithMonitor(monitor) + WithName("dirk").
    • startClientCertManager likewise.
    • Both call sites updated to pass the monitor returned by initMonitoringAndMetrics.
  • go.mod: bump github.com/attestantio/go-certmanager to the PR Run rules checks in parallel. #16 tip.

Tests

  • certmanager_test.go: four new unit tests exercising the wiring.
    • TestStartCertManagerWiresMonitorWithName / TestStartClientCertManagerWiresMonitorWithName — happy path; if either WithMonitor or WithName is ever dropped, construction fails with ErrNoNameWithMonitor.
    • TestStartCertManagerMonitorWithoutNameRejected / TestStartClientCertManagerMonitorWithoutNameRejected — documents the contract Dirk relies on directly against standardservercert.New / standardclientcert.New.

Test plan

  • go test ./... green (510 tests)
  • End-to-end integration via the attestantio/ethereum-package Vouch+Dirk Kurtosis devnet: both certmanager_certificate_{not_after,not_before}_seconds{name="dirk",role="server"} and {name="dirk",role="client"} series visible on each Dirk's /metrics endpoint; values match the served cert's notAfter/notBefore.

Threads the metrics monitor and a stable certificate name into the
server and client certificate managers via go-certmanager's new
WithMonitor/WithName options. Both managers use name="dirk"; the
role label ("server" vs "client") distinguishes inbound gRPC from
outbound peer connections.

Adds a unit test guarding the wiring: exercising the sentinel
ErrNoNameWithMonitor path and the happy-path with a
prometheus-presenter monitor for both server and client managers.

Bumps go-certmanager to the PR #16 tip (adds metrics.Service
interface + Prometheus gauges).
@AntiD2ta AntiD2ta self-assigned this Apr 23, 2026
@AntiD2ta AntiD2ta marked this pull request as draft April 23, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant