package metricserver
import "gvisor.dev/gvisor/runsc/metricserver"
Package metricserver implements a Prometheus metric server for runsc data.
Index ¶
Variables ¶
var ( SandboxPresenceMetric = prometheus.Metric{ Name: "sandbox_presence", Type: prometheus.TypeGauge, Help: "Boolean metric set to 1 for each known sandbox.", } SandboxRunningMetric = prometheus.Metric{ Name: "sandbox_running", Type: prometheus.TypeGauge, Help: "Boolean metric set to 1 for each running sandbox.", } SandboxCheckpointedMetric = prometheus.Metric{ Name: "sandbox_checkpointed", Type: prometheus.TypeGauge, Help: "Boolean metric set to 1 for each checkpointed sandbox.", } SandboxRestoredMetric = prometheus.Metric{ Name: "sandbox_restored", Type: prometheus.TypeGauge, Help: "Boolean metric set to 1 for each restored sandbox.", } SandboxMetadataMetric = prometheus.Metric{ Name: "sandbox_metadata", Type: prometheus.TypeGauge, Help: "Key-value pairs about per-sandbox metadata.", } SandboxCapabilitiesMetric = prometheus.Metric{ Name: "sandbox_capabilities", Type: prometheus.TypeGauge, Help: "Linux capabilities added within containers of the sandbox.", } SandboxCapabilitiesMetricLabel = "capability" SpecMetadataMetric = prometheus.Metric{ Name: "spec_metadata", Type: prometheus.TypeGauge, Help: "Key-value pairs about OCI spec metadata.", } SandboxCreationMetric = prometheus.Metric{ Name: "sandbox_creation_time_seconds", Type: prometheus.TypeGauge, Help: "When the sandbox was created, as a unix timestamp in seconds.", } NumRunningSandboxesMetric = prometheus.Metric{ Name: "num_sandboxes_running", Type: prometheus.TypeGauge, Help: "Number of sandboxes running at present.", } NumCannotExportSandboxesMetric = prometheus.Metric{ Name: "num_sandboxes_broken_metrics", Type: prometheus.TypeGauge, Help: "Number of sandboxes from which we cannot export metrics.", } NumTotalSandboxesMetric = prometheus.Metric{ Name: "num_sandboxes_total", Type: prometheus.TypeCounter, Help: "Counter of sandboxes that have ever been started.", } NumCheckpointedSandboxesMetric = prometheus.Metric{ Name: "num_sandboxes_checkpointed", Type: prometheus.TypeCounter, Help: "Counter of sandboxes that have been checkpointed.", } NumRestoredSandboxesMetric = prometheus.Metric{ Name: "num_sandboxes_restored", Type: prometheus.TypeCounter, Help: "Counter of sandboxes that have been restored.", } )
Metrics generated by the metrics server itself.
var Metrics = []*prometheus.Metric{ &SandboxPresenceMetric, &SandboxRunningMetric, &SandboxMetadataMetric, &SandboxCheckpointedMetric, &SandboxRestoredMetric, &SandboxCapabilitiesMetric, &SpecMetadataMetric, &SandboxCreationMetric, &NumRunningSandboxesMetric, &NumCannotExportSandboxesMetric, &NumTotalSandboxesMetric, &NumCheckpointedSandboxesMetric, &NumRestoredSandboxesMetric, &prometheus.ProcessStartTimeSeconds, }
Metrics is a list of metrics that the metric server generates.
Types ¶
type Server ¶
type Server struct { // Config is the main runsc configuration. Config *config.Config // ExporterPrefix is used as prefix for all metric names following Prometheus exporter convention. ExporterPrefix string // PIDFile, if set, will cause the metric server to write its own PID to this file after binding // to the requested address. The parent directory of this file must already exist. PIDFile string // ExposeProfileEndpoints, if true, exposes /runsc-metrics/profile-cpu and // /runsc-metrics/profile-heap to get profiling data about the metric server. ExposeProfileEndpoints bool // AllowUnknownRoot causes the metric server to keep running regardless of the existence of the // Config's root directory or the metric server's ability to access it. AllowUnknownRoot bool }
Server is the set of options to run a metric server. Initialize this struct and then call Run on it to run the metric server.
func (*Server) Run ¶
Run runs the metric server. It blocks until the server is instructed to exit, e.g. via signal.
Source Files ¶
metricserver.go metricserver_http.go metricserver_lifecycle.go metricserver_metrics.go metricserver_profile.go
Directories ¶
Path | Synopsis |
---|---|
runsc/metricserver/containermetrics | Package containermetrics returns metrics and labels interesting to export about a container or sandbox. |
- Version
- v0.0.0-20250605235530-a6711d1e1dc6 (latest)
- Published
- Jun 5, 2025
- Platform
- linux/amd64
- Imports
- 27 packages
- Last checked
- 4 hours ago –
Tools for package owners.