mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
runsc metric-server: Export aggregate metrics about number of sandboxes.
These metrics were defined but not actually populated. PiperOrigin-RevId: 511314252
This commit is contained in:
committed by
gVisor bot
parent
f7a3a23d30
commit
87a0113a69
@@ -556,6 +556,7 @@ func (m *MetricServer) serveMetrics(w http.ResponseWriter, req *http.Request) ht
|
||||
loadedSandboxes = append(loadedSandboxes, <-loadedSandboxesCh)
|
||||
}
|
||||
close(loadedSandboxesCh)
|
||||
numSandboxesTotal := m.numSandboxes
|
||||
m.mu.Unlock()
|
||||
|
||||
// Now iterate over all sandboxes.
|
||||
@@ -683,6 +684,11 @@ func (m *MetricServer) serveMetrics(w http.ResponseWriter, req *http.Request) ht
|
||||
snapshotsToOptions[snapshotAndOptions.snapshot] = snapshotAndOptions.options
|
||||
}
|
||||
|
||||
// Add our own metrics.
|
||||
selfMetrics.Add(prometheus.NewIntData(&NumRunningSandboxesMetric, meta.numRunningSandboxes))
|
||||
selfMetrics.Add(prometheus.NewIntData(&NumCannotExportSandboxesMetric, meta.numCannotExportSandboxes))
|
||||
selfMetrics.Add(prometheus.NewIntData(&NumTotalSandboxesMetric, numSandboxesTotal))
|
||||
|
||||
// Write out all data.
|
||||
lastMetricsWrittenSize := int(m.lastMetricsWrittenSize.Load())
|
||||
metricsWritten := make(map[string]bool, lastMetricsWrittenSize)
|
||||
|
||||
Reference in New Issue
Block a user