feat(metrics): emit certificate annual cost basis gauges - #359
Open
evan-datadog wants to merge 2 commits into
Open
feat(metrics): emit certificate annual cost basis gauges#359evan-datadog wants to merge 2 commits into
evan-datadog wants to merge 2 commits into
Conversation
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
Workspace: local
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
send_certificate_cost_metrics()tolemur/certificates/service.py, acost_metricsCLI command, and a hook in thecertificate_expirations_metricscelery task so Lemur emits per-certificate annual cost gauges:lemur.certificates.annual_cost(gauge, USD) — one point per cert; sum = fleet costlemur.certificates.count(gauge, 1) — one point per cert for countinglemur.certificates.total_annual_cost(gauge, USD) — fleet totalTags:
issuer,cert_type(fqdn|wildcard_san),cert_name,owner,expiration,status(active|replaced|expired|revoked|ca). Thestatustag lets the dashboard split ongoing vs gross cost basis.Pricing rules (annual USD — all estimates for cost-basis governance)
Pricing lives in
CERT_ANNUAL_PRICEin service.py and is mirrored in the Datadog reference tablelemur_certificate_pricingand 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
test_send_certificate_cost_metricscovering DigiCert FQDN/wildcard, Let's Encrypt free, Sectigo wildcard, and unpriced certs.test_send_certificate_expiration_metricsstill passes; fulltest_certificates.pyhas the same 10 pre-existing failures as master (Vault not configured for private-key tests).