Merge pull request #73549 from haiyanmeng/runtimeclass

Add monitoring for RuntimeClass
This commit is contained in:
Kubernetes Prow Robot 2019-02-05 15:14:38 -08:00 committed by GitHub
commit 459e509f94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View File

@ -178,10 +178,15 @@ func (in instrumentedRuntimeService) Attach(req *runtimeapi.AttachRequest) (*run
func (in instrumentedRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error) {
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)
recordError(operation, err)
if err != nil {
metrics.RunPodSandboxErrors.WithLabelValues(runtimeHandler).Inc()
}
return out, err
}

View File

@ -65,6 +65,10 @@ const (
ConfigUIDLabelKey = "node_config_uid"
ConfigResourceVersionLabelKey = "node_config_resource_version"
KubeletConfigKeyLabelKey = "node_config_kubelet_key"
// Metrics keys for RuntimeClass
RunPodSandboxLatenciesKey = "run_podsandbox_latencies"
RunPodSandboxErrorsKey = "run_podsandbox_errors"
)
var (
@ -210,6 +214,22 @@ var (
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