-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Discussed in #95
Originally posted by NBouchia February 24, 2026
The Gauge metrics certstreamservergo_certs_by_log_total are initialized only once (global boolean ctLogMetricsInitialized) and does not get updated when new URLs are added to Google’s log_list.json. Is that an accurate interpretation of the code?
internal/metrics/prometheus.go
// WritePrometheus provides an easy way to write metrics to a writer.
func WritePrometheus(w io.Writer, exposeProcessMetrics bool) {
ctLogMetricsInitMutex.Lock()
if !ctLogMetricsInitialized {
initCtLogMetrics()
}
ctLogMetricsInitMutex.Unlock()
getSkippedCertMetrics()
metrics.WritePrometheus(w, exposeProcessMetrics)
}
// For having metrics regarding each individual CT log, we need to register them manually.
// initCtLogMetrics fetches all the CT Logs and registers one metric per log.
func initCtLogMetrics() {
logs := certificatetransparency.GetLogOperators()
for operator, urls := range logs {
operator := operator // Copy variable to new scope
for i := 0; i < len(urls); i++ {
url := urls[i]
name := fmt.Sprintf("certstreamservergo_certs_by_log_total{url=\"%s\",operator=\"%s\"}", url, operator)
metrics.NewGauge(name, func() float64 {
return float64(getCertCountForLog(operator, url))
})
}
}
if len(logs) > 0 {
ctLogMetricsInitialized = true
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels