feat(prometheus): expose domain expiry days as a metric (#7083)#7168
Open
dharunashokkumar wants to merge 3 commits intolouislam:masterfrom
Open
feat(prometheus): expose domain expiry days as a metric (#7083)#7168dharunashokkumar wants to merge 3 commits intolouislam:masterfrom
dharunashokkumar wants to merge 3 commits intolouislam:masterfrom
Conversation
Adds monitor_domain_expiry_days_remaining gauge so users can alert on expiring domains via Prometheus/Grafana.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Prometheus gauge to expose “days remaining until domain expiry” per monitor so users can alert via Prometheus/Grafana.
Changes:
- Added
monitor_domain_expiry_days_remaininggauge and wired it into the Prometheus update/remove lifecycle. - Plumbed domain expiry “days remaining” from the existing domain expiry/RDAP flow in
Monitorinto the Prometheus update call.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| server/prometheus.js | Defines and updates/removes the new Prometheus gauge and extends update() to accept domain expiry info. |
| server/model/monitor.js | Collects domain expiry “days remaining” during heartbeat and passes it to Prometheus. |
Comment on lines
+1046
to
+1049
| const domain = await DomainExpiry.findByDomainNameOrCreate(supportInfo.domain); | ||
| if (domain) { | ||
| domainExpiryInfo = { daysRemaining: domain.daysRemaining }; | ||
| } |
Comment on lines
155
to
+162
| * @param {object} heartbeat Heartbeat details | ||
| * @param {object} tlsInfo TLS details | ||
| * @param {{data24h: UptimeDataResult, data30d: UptimeDataResult, data1y:UptimeDataResult} | null} uptime the uptime and average response rate over a variety of fixed windows | ||
| * @param {object} domainExpiryInfo Domain expiry details | ||
| * @param {number} domainExpiryInfo.daysRemaining Number of days until domain expires | ||
| * @returns {void} | ||
| */ | ||
| update(heartbeat, tlsInfo, uptime) { | ||
| update(heartbeat, tlsInfo, uptime, domainExpiryInfo) { |
Comment on lines
+188
to
+192
| monitorDomainExpiryDaysRemaining.set(this.monitorLabelValues, domainExpiryInfo.daysRemaining); | ||
| } | ||
| } catch (e) { | ||
| log.error("prometheus", "Caught error", e); | ||
| } |
| * @returns {void} | ||
| */ | ||
| update(heartbeat, tlsInfo, uptime) { | ||
| update(heartbeat, tlsInfo, uptime, domainExpiryInfo) { |
|
Maybe this could be renamed to just And maybe also an extra |
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.
Adds monitor_domain_expiry_days_remaining gauge so users can alert on expiring domains via Prometheus/Grafana.
Summary
In this pull request, the following changes are made:
Added a new
monitor_domain_expiry_days_remainingPrometheus gauge inserver/prometheus.js, following the same pattern as theexisting
monitor_cert_days_remainingmetric.server/model/monitor.jsinto the prometheus update call, so the metric getspopulated each heartbeat cycle.
No UI changes, no new dependencies.
Please follow this checklist to avoid unnecessary back and forth (click to expand)
I understand that I am responsible for and able to explain every line of code I submit.
Screenshots for Visual Changes
UPDOWN