kubernetesk8s.io/kubernetes/pkg/scheduler/metrics Index | Files

package metrics

import "k8s.io/kubernetes/pkg/scheduler/metrics"

Index

Constants

const (
	// SchedulerSubsystem - subsystem name used by scheduler
	SchedulerSubsystem = "scheduler"
	// SchedulingLatencyName - scheduler latency metric name
	SchedulingLatencyName = "scheduling_duration_seconds"
	// DeprecatedSchedulingLatencyName - scheduler latency metric name which is deprecated
	DeprecatedSchedulingLatencyName = "scheduling_latency_seconds"

	// OperationLabel - operation label name
	OperationLabel = "operation"

	// PredicateEvaluation - predicate evaluation operation label value
	PredicateEvaluation = "predicate_evaluation"
	// PriorityEvaluation - priority evaluation operation label value
	PriorityEvaluation = "priority_evaluation"
	// PreemptionEvaluation - preemption evaluation operation label value (occurs in case of scheduling fitError).
	PreemptionEvaluation = "preemption_evaluation"
	// Binding - binding operation label value
	Binding = "binding"
)

Variables

var (

	// PodScheduleSuccesses counts how many pods were scheduled.
	// This metric will be initialized again in Register() to assure the metric is not no-op metric.
	PodScheduleSuccesses = scheduleAttempts.With(prometheus.Labels{"result": "scheduled"})
	// PodScheduleFailures counts how many pods could not be scheduled.
	// This metric will be initialized again in Register() to assure the metric is not no-op metric.
	PodScheduleFailures = scheduleAttempts.With(prometheus.Labels{"result": "unschedulable"})
	// PodScheduleErrors counts how many pods could not be scheduled due to a scheduler error.
	// This metric will be initialized again in Register() to assure the metric is not no-op metric.
	PodScheduleErrors = scheduleAttempts.With(prometheus.Labels{"result": "error"})
	SchedulingLatency = metrics.NewSummaryVec(
		&metrics.SummaryOpts{
			Subsystem: SchedulerSubsystem,
			Name:      SchedulingLatencyName,
			Help:      "Scheduling latency in seconds split by sub-parts of the scheduling operation",

			MaxAge:         5 * time.Hour,
			StabilityLevel: metrics.ALPHA,
		},
		[]string{OperationLabel},
	)
	DeprecatedSchedulingLatency = metrics.NewSummaryVec(
		&metrics.SummaryOpts{
			Subsystem: SchedulerSubsystem,
			Name:      DeprecatedSchedulingLatencyName,
			Help:      "(Deprecated) Scheduling latency in seconds split by sub-parts of the scheduling operation",

			MaxAge:         5 * time.Hour,
			StabilityLevel: metrics.ALPHA,
		},
		[]string{OperationLabel},
	)
	E2eSchedulingLatency = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "e2e_scheduling_duration_seconds",
			Help:           "E2e scheduling latency in seconds (scheduling algorithm + binding)",
			Buckets:        prometheus.ExponentialBuckets(0.001, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	DeprecatedE2eSchedulingLatency = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "e2e_scheduling_latency_microseconds",
			Help:           "(Deprecated) E2e scheduling latency in microseconds (scheduling algorithm + binding)",
			Buckets:        prometheus.ExponentialBuckets(1000, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	SchedulingAlgorithmLatency = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "scheduling_algorithm_duration_seconds",
			Help:           "Scheduling algorithm latency in seconds",
			Buckets:        prometheus.ExponentialBuckets(0.001, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	DeprecatedSchedulingAlgorithmLatency = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "scheduling_algorithm_latency_microseconds",
			Help:           "(Deprecated) Scheduling algorithm latency in microseconds",
			Buckets:        prometheus.ExponentialBuckets(1000, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	SchedulingAlgorithmPredicateEvaluationDuration = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "scheduling_algorithm_predicate_evaluation_seconds",
			Help:           "Scheduling algorithm predicate evaluation duration in seconds",
			Buckets:        prometheus.ExponentialBuckets(0.001, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	DeprecatedSchedulingAlgorithmPredicateEvaluationDuration = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "scheduling_algorithm_predicate_evaluation",
			Help:           "(Deprecated) Scheduling algorithm predicate evaluation duration in microseconds",
			Buckets:        prometheus.ExponentialBuckets(1000, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	SchedulingAlgorithmPriorityEvaluationDuration = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "scheduling_algorithm_priority_evaluation_seconds",
			Help:           "Scheduling algorithm priority evaluation duration in seconds",
			Buckets:        prometheus.ExponentialBuckets(0.001, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	DeprecatedSchedulingAlgorithmPriorityEvaluationDuration = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "scheduling_algorithm_priority_evaluation",
			Help:           "(Deprecated) Scheduling algorithm priority evaluation duration in microseconds",
			Buckets:        prometheus.ExponentialBuckets(1000, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	SchedulingAlgorithmPremptionEvaluationDuration = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "scheduling_algorithm_preemption_evaluation_seconds",
			Help:           "Scheduling algorithm preemption evaluation duration in seconds",
			Buckets:        prometheus.ExponentialBuckets(0.001, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	DeprecatedSchedulingAlgorithmPremptionEvaluationDuration = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "scheduling_algorithm_preemption_evaluation",
			Help:           "(Deprecated) Scheduling algorithm preemption evaluation duration in microseconds",
			Buckets:        prometheus.ExponentialBuckets(1000, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	BindingLatency = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "binding_duration_seconds",
			Help:           "Binding latency in seconds",
			Buckets:        prometheus.ExponentialBuckets(0.001, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	DeprecatedBindingLatency = metrics.NewHistogram(
		&metrics.HistogramOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "binding_latency_microseconds",
			Help:           "(Deprecated) Binding latency in microseconds",
			Buckets:        prometheus.ExponentialBuckets(1000, 2, 15),
			StabilityLevel: metrics.ALPHA,
		},
	)
	PreemptionVictims = metrics.NewGauge(
		&metrics.GaugeOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "pod_preemption_victims",
			Help:           "Number of selected preemption victims",
			StabilityLevel: metrics.ALPHA,
		})
	PreemptionAttempts = metrics.NewCounter(
		&metrics.CounterOpts{
			Subsystem:      SchedulerSubsystem,
			Name:           "total_preemption_attempts",
			Help:           "Total preemption attempts in the cluster till now",
			StabilityLevel: metrics.ALPHA,
		})
)

All the histogram based metrics have 1ms as size for the smallest bucket.

Functions

func ActivePods

func ActivePods() metrics.GaugeMetric

ActivePods returns the pending pods metrics with the label active

func BackoffPods

func BackoffPods() metrics.GaugeMetric

BackoffPods returns the pending pods metrics with the label backoff

func Register

func Register()

Register all metrics.

func Reset

func Reset()

Reset resets metrics

func SinceInMicroseconds

func SinceInMicroseconds(start time.Time) float64

SinceInMicroseconds gets the time since the specified start in microseconds.

func SinceInSeconds

func SinceInSeconds(start time.Time) float64

SinceInSeconds gets the time since the specified start in seconds.

func UnschedulablePods

func UnschedulablePods() metrics.GaugeMetric

UnschedulablePods returns the pending pods metrics with the label unschedulable

Types

type MetricRecorder

type MetricRecorder interface {
	Inc()
	Dec()
	Clear()
}

MetricRecorder represents a metric recorder which takes action when the metric Inc(), Dec() and Clear()

type PendingPodsRecorder

type PendingPodsRecorder struct {
	// contains filtered or unexported fields
}

PendingPodsRecorder is an implementation of MetricRecorder

func NewActivePodsRecorder

func NewActivePodsRecorder() *PendingPodsRecorder

NewActivePodsRecorder returns ActivePods in a Prometheus metric fashion

func NewBackoffPodsRecorder

func NewBackoffPodsRecorder() *PendingPodsRecorder

NewBackoffPodsRecorder returns BackoffPods in a Prometheus metric fashion

func NewUnschedulablePodsRecorder

func NewUnschedulablePodsRecorder() *PendingPodsRecorder

NewUnschedulablePodsRecorder returns UnschedulablePods in a Prometheus metric fashion

func (*PendingPodsRecorder) Clear

func (r *PendingPodsRecorder) Clear()

Clear set a metric counter to 0, in an atomic way

func (*PendingPodsRecorder) Dec

func (r *PendingPodsRecorder) Dec()

Dec decreases a metric counter by 1, in an atomic way

func (*PendingPodsRecorder) Inc

func (r *PendingPodsRecorder) Inc()

Inc increases a metric counter by 1, in an atomic way

Source Files

metric_recorder.go metrics.go

Version
v1.16.9
Published
Apr 16, 2020
Platform
js/wasm
Imports
6 packages
Last checked
16 minutes ago

Tools for package owners.