mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 02:11:09 +00:00
node: topology-mgr: add metric to measure topology mgr admission latency
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
This commit is contained in:
parent
fc7b25cf72
commit
bc941633c1
@ -18,6 +18,7 @@ package topologymanager
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
cadvisorapi "github.com/google/cadvisor/info/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
@ -209,9 +210,12 @@ func (m *manager) RemoveContainer(containerID string) error {
|
||||
|
||||
func (m *manager) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.PodAdmitResult {
|
||||
klog.InfoS("Topology Admit Handler")
|
||||
|
||||
metrics.TopologyManagerAdmissionRequestsTotal.Inc()
|
||||
pod := attrs.Pod
|
||||
|
||||
return m.scope.Admit(pod)
|
||||
startTime := time.Now()
|
||||
podAdmitResult := m.scope.Admit(pod)
|
||||
metrics.TopologyManagerAdmissionDuration.Observe(float64(time.Since(startTime).Milliseconds()))
|
||||
|
||||
return podAdmitResult
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ const (
|
||||
// Metrics to track the Topology manager behavior
|
||||
TopologyManagerAdmissionRequestsTotalKey = "topology_manager_admission_requests_total"
|
||||
TopologyManagerAdmissionErrorsTotalKey = "topology_manager_admission_errors_total"
|
||||
TopologyManagerAdmissionDurationKey = "topology_manager_admission_duration_ms"
|
||||
|
||||
// Values used in metric labels
|
||||
Container = "container"
|
||||
@ -573,6 +574,17 @@ var (
|
||||
StabilityLevel: metrics.ALPHA,
|
||||
},
|
||||
)
|
||||
|
||||
// TopologyManagerAdmissionDuration is a Histogram that tracks the duration (in seconds) to serve a pod admission request.
|
||||
TopologyManagerAdmissionDuration = metrics.NewHistogram(
|
||||
&metrics.HistogramOpts{
|
||||
Subsystem: KubeletSubsystem,
|
||||
Name: TopologyManagerAdmissionDurationKey,
|
||||
Help: "Duration in milliseconds to serve a pod admission request.",
|
||||
Buckets: metrics.ExponentialBuckets(.05, 2, 15),
|
||||
StabilityLevel: metrics.ALPHA,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
var registerMetrics sync.Once
|
||||
@ -626,6 +638,7 @@ func Register(collectors ...metrics.StableCollector) {
|
||||
legacyregistry.MustRegister(CPUManagerPinningErrorsTotal)
|
||||
legacyregistry.MustRegister(TopologyManagerAdmissionRequestsTotal)
|
||||
legacyregistry.MustRegister(TopologyManagerAdmissionErrorsTotal)
|
||||
legacyregistry.MustRegister(TopologyManagerAdmissionDuration)
|
||||
|
||||
for _, collector := range collectors {
|
||||
legacyregistry.CustomMustRegister(collector)
|
||||
|
Loading…
Reference in New Issue
Block a user