Documentation ¶
Overview ¶
Package metricserver implements a Prometheus metric server for runsc data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
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.", } 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.", } )
Metrics generated by the metrics server itself.
View Source
var Metrics = []*prometheus.Metric{ &SandboxPresenceMetric, &SandboxRunningMetric, &SandboxMetadataMetric, &SandboxCapabilitiesMetric, &SpecMetadataMetric, &SandboxCreationMetric, &NumRunningSandboxesMetric, &NumCannotExportSandboxesMetric, &NumTotalSandboxesMetric, &prometheus.ProcessStartTimeSeconds, }
Metrics is a list of metrics that the metric server generates.
Functions ¶
func ComputeSpecMetadata ¶
ComputeSpecMetadata returns the labels for the `spec_metadata` metric. It merges data from the Specs of multiple containers running within the same sandbox. This function must support being called with `allContainers` being nil. It must return the same set of label keys regardless of how many containers are in `allContainers`.
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.
Click to show internal directories.
Click to hide internal directories.