Skip to content

identity: add workload certificate expiry metric - #1889

Open
jlojosnegros wants to merge 1 commit into
istio:masterfrom
jlojosnegros:feat/workload-cert-expiry-metric
Open

identity: add workload certificate expiry metric#1889
jlojosnegros wants to merge 1 commit into
istio:masterfrom
jlojosnegros:feat/workload-cert-expiry-metric

Conversation

@jlojosnegros

@jlojosnegros jlojosnegros commented May 5, 2026

Copy link
Copy Markdown
Contributor

ztunnel has no Prometheus metric for workload certificate expiration. Operators
cannot alert on certificates approaching expiry or detect silent renewal failures.
The sidecar equivalent (istio_agent_cert_expiry_seconds) exists but has no
counterpart in Ambient Mesh.

Add istio_cert_expiry_seconds, a Gauge labeled by identity (SPIFFE URI),
set to the Unix timestamp when the workload certificate expires. The metric is
set in Worker when a certificate fetch succeeds and removed when the identity
is forgotten, avoiding stale series for deleted workloads.

The value is an absolute Unix timestamp rather than seconds-remaining so it stays
correct across Prometheus scrapes without requiring a renewal cycle to refresh it.
Operators compute time-to-expiry in PromQL:

(istio_cert_expiry_seconds - time()) < 7200
File Change
src/identity/metrics.rs New — Metrics struct with the expiry gauge
src/identity.rs Declare pub mod metrics
src/identity/manager.rs Field in Worker; set on fetch, remove on forget
src/app.rs Register metric in Prometheus registry
README.md Document under unstable metrics

Solves: #1748

Adds istio_cert_expiry_seconds, a Gauge that tracks the Unix timestamp
at which each workload certificate expires, labeled by identity (SPIFFE URI).

The metric is set in the Worker when a certificate fetch succeeds and
removed when the identity is forgotten, avoiding stale series for
deleted workloads.

Signed-off-by: Jose Luis Ojosnegros Manchón <jojosneg@redhat.com>
@jlojosnegros
jlojosnegros requested review from a team as code owners May 5, 2026 09:06
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants