gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/runsc/metricserver/metricserver_metrics.go (about)

     1  // Copyright 2023 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package metricserver
    16  
    17  import (
    18  	"gvisor.dev/gvisor/pkg/prometheus"
    19  )
    20  
    21  // Metrics generated by the metrics server itself.
    22  var (
    23  	SandboxPresenceMetric = prometheus.Metric{
    24  		Name: "sandbox_presence",
    25  		Type: prometheus.TypeGauge,
    26  		Help: "Boolean metric set to 1 for each known sandbox.",
    27  	}
    28  	SandboxRunningMetric = prometheus.Metric{
    29  		Name: "sandbox_running",
    30  		Type: prometheus.TypeGauge,
    31  		Help: "Boolean metric set to 1 for each running sandbox.",
    32  	}
    33  	SandboxMetadataMetric = prometheus.Metric{
    34  		Name: "sandbox_metadata",
    35  		Type: prometheus.TypeGauge,
    36  		Help: "Key-value pairs about per-sandbox metadata.",
    37  	}
    38  	SandboxCapabilitiesMetric = prometheus.Metric{
    39  		Name: "sandbox_capabilities",
    40  		Type: prometheus.TypeGauge,
    41  		Help: "Linux capabilities added within containers of the sandbox.",
    42  	}
    43  	SandboxCapabilitiesMetricLabel = "capability"
    44  	SpecMetadataMetric             = prometheus.Metric{
    45  		Name: "spec_metadata",
    46  		Type: prometheus.TypeGauge,
    47  		Help: "Key-value pairs about OCI spec metadata.",
    48  	}
    49  	SandboxCreationMetric = prometheus.Metric{
    50  		Name: "sandbox_creation_time_seconds",
    51  		Type: prometheus.TypeGauge,
    52  		Help: "When the sandbox was created, as a unix timestamp in seconds.",
    53  	}
    54  	NumRunningSandboxesMetric = prometheus.Metric{
    55  		Name: "num_sandboxes_running",
    56  		Type: prometheus.TypeGauge,
    57  		Help: "Number of sandboxes running at present.",
    58  	}
    59  	NumCannotExportSandboxesMetric = prometheus.Metric{
    60  		Name: "num_sandboxes_broken_metrics",
    61  		Type: prometheus.TypeGauge,
    62  		Help: "Number of sandboxes from which we cannot export metrics.",
    63  	}
    64  	NumTotalSandboxesMetric = prometheus.Metric{
    65  		Name: "num_sandboxes_total",
    66  		Type: prometheus.TypeCounter,
    67  		Help: "Counter of sandboxes that have ever been started.",
    68  	}
    69  )
    70  
    71  // Metrics is a list of metrics that the metric server generates.
    72  var Metrics = []*prometheus.Metric{
    73  	&SandboxPresenceMetric,
    74  	&SandboxRunningMetric,
    75  	&SandboxMetadataMetric,
    76  	&SandboxCapabilitiesMetric,
    77  	&SpecMetadataMetric,
    78  	&SandboxCreationMetric,
    79  	&NumRunningSandboxesMetric,
    80  	&NumCannotExportSandboxesMetric,
    81  	&NumTotalSandboxesMetric,
    82  	&prometheus.ProcessStartTimeSeconds,
    83  }