mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Add monitoring for RuntimeClass
This commit is contained in:
parent
732cb10019
commit
18bcdcecce
@ -178,10 +178,15 @@ func (in instrumentedRuntimeService) Attach(req *runtimeapi.AttachRequest) (*run
|
|||||||
|
|
||||||
func (in instrumentedRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error) {
|
func (in instrumentedRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error) {
|
||||||
const operation = "run_podsandbox"
|
const operation = "run_podsandbox"
|
||||||
defer recordOperation(operation, time.Now())
|
startTime := time.Now()
|
||||||
|
defer recordOperation(operation, startTime)
|
||||||
|
defer metrics.RunPodSandboxLatencies.WithLabelValues(runtimeHandler).Observe(metrics.SinceInMicroseconds(startTime))
|
||||||
|
|
||||||
out, err := in.service.RunPodSandbox(config, runtimeHandler)
|
out, err := in.service.RunPodSandbox(config, runtimeHandler)
|
||||||
recordError(operation, err)
|
recordError(operation, err)
|
||||||
|
if err != nil {
|
||||||
|
metrics.RunPodSandboxErrors.WithLabelValues(runtimeHandler).Inc()
|
||||||
|
}
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,10 @@ const (
|
|||||||
ConfigUIDLabelKey = "node_config_uid"
|
ConfigUIDLabelKey = "node_config_uid"
|
||||||
ConfigResourceVersionLabelKey = "node_config_resource_version"
|
ConfigResourceVersionLabelKey = "node_config_resource_version"
|
||||||
KubeletConfigKeyLabelKey = "node_config_kubelet_key"
|
KubeletConfigKeyLabelKey = "node_config_kubelet_key"
|
||||||
|
|
||||||
|
// Metrics keys for RuntimeClass
|
||||||
|
RunPodSandboxLatenciesKey = "run_podsandbox_latencies"
|
||||||
|
RunPodSandboxErrorsKey = "run_podsandbox_errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -199,6 +203,22 @@ var (
|
|||||||
Help: "This metric is true (1) if the node is experiencing a configuration-related error, false (0) otherwise.",
|
Help: "This metric is true (1) if the node is experiencing a configuration-related error, false (0) otherwise.",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
RunPodSandboxLatencies = prometheus.NewSummaryVec(
|
||||||
|
prometheus.SummaryOpts{
|
||||||
|
Subsystem: KubeletSubsystem,
|
||||||
|
Name: RunPodSandboxLatenciesKey,
|
||||||
|
Help: "Latencies in microseconds of the run_podsandbox operations. Broken down by RuntimeClass.",
|
||||||
|
},
|
||||||
|
[]string{"runtime_handler"},
|
||||||
|
)
|
||||||
|
RunPodSandboxErrors = prometheus.NewCounterVec(
|
||||||
|
prometheus.CounterOpts{
|
||||||
|
Subsystem: KubeletSubsystem,
|
||||||
|
Name: RunPodSandboxErrorsKey,
|
||||||
|
Help: "Cumulative number of the run_podsandbox operation errors by RuntimeClass.",
|
||||||
|
},
|
||||||
|
[]string{"runtime_handler"},
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
var registerMetrics sync.Once
|
var registerMetrics sync.Once
|
||||||
|
Loading…
Reference in New Issue
Block a user