Skip to content

feat(metrics): emit certificate annual cost basis gauges - #359

Open
evan-datadog wants to merge 2 commits into
masterfrom
evan/lemur-cert-cost-metrics
Open

feat(metrics): emit certificate annual cost basis gauges#359
evan-datadog wants to merge 2 commits into
masterfrom
evan/lemur-cert-cost-metrics

Conversation

@evan-datadog

@evan-datadog evan-datadog commented Aug 11, 2026

Copy link
Copy Markdown

What

Adds send_certificate_cost_metrics() to lemur/certificates/service.py, a cost_metrics CLI command, and a hook in the certificate_expirations_metrics celery task so Lemur emits per-certificate annual cost gauges:

  • lemur.certificates.annual_cost (gauge, USD) — one point per cert; sum = fleet cost
  • lemur.certificates.count (gauge, 1) — one point per cert for counting
  • lemur.certificates.total_annual_cost (gauge, USD) — fleet total

Tags: issuer, cert_type (fqdn | wildcard_san), cert_name, owner, expiration, status (active | replaced | expired | revoked | ca). The status tag lets the dashboard split ongoing vs gross cost basis.

Pricing rules (annual USD — all estimates for cost-basis governance)

Issuer Type Price
DigiCert FQDN $150
DigiCert Wildcard SAN $550
Sectigo Wildcard OV $400 (confirmed estimate; mid of $300–499 WC OV range)
Let's Encrypt any free

Pricing lives in CERT_ANNUAL_PRICE in service.py and is mirrored in the Datadog reference table lemur_certificate_pricing and the 'Lemur Certificate Cost Basis' dashboard (wsp-8mi-daz).

Why

Populate the 'Lemur Certificate Cost Basis' dashboard with real metric data for certificate cost governance.

Tests

  • Added test_send_certificate_cost_metrics covering DigiCert FQDN/wildcard, Let's Encrypt free, Sectigo wildcard, and unpriced certs.
  • test_send_certificate_expiration_metrics still passes; full test_certificates.py has the same 10 pre-existing failures as master (Vault not configured for private-key tests).
  • flake8 clean.

Add send_certificate_cost_metrics() to emit per-cert annual cost
(certificates.annual_cost, gauge USD), a per-cert count
(certificates.count), and a fleet total
(certificates.total_annual_cost) tagged with issuer, cert_type,
cert_name, owner, expiration and status (active/replaced/expired/
revoked/ca). Pricing: DigiCert FQDN $150, DigiCert wildcard $550,
Sectigo wildcard OV $400 (assumed), Let's Encrypt free.

Wire it into the certificates CLI (cost_metrics command) and the
certificate_expirations_metrics celery task so the 'Lemur Certificate
Cost Basis' dashboard (wsp-8mi-daz) populates.

Refs NIT-26-07

Workspace: local
@evan-datadog
evan-datadog requested review from a team as code owners August 11, 2026 18:07
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