package metrics
import "k8s.io/apiserver/pkg/util/flowcontrol/metrics"
Index ¶
- Constants
- Variables
- func AddDispatch(ctx context.Context, priorityLevel, flowSchema string)
- func AddDispatchWithNoAccommodation(priorityLevel, flowSchema string)
- func AddEpochAdvance(ctx context.Context, priorityLevel string, success bool)
- func AddReject(ctx context.Context, priorityLevel, flowSchema, reason string)
- func AddRequestsExecuting(ctx context.Context, priorityLevel, flowSchema string, delta int)
- func AddRequestsInQueues(ctx context.Context, priorityLevel, flowSchema string, delta int)
- func AddSeatConcurrencyInUse(priorityLevel, flowSchema string, delta int)
- func AddSeatsInQueues(ctx context.Context, priorityLevel, flowSchema string, delta int)
- func GatherAndCompare(expected string, metricNames ...string) error
- func NotePriorityLevelConcurrencyAdjustment(priorityLevel string, seatDemandHWM, seatDemandAvg, seatDemandStdev, seatDemandSmoothed, seatDemandTarget float64, currentCL int)
- func ObserveExecutionDuration(ctx context.Context, priorityLevel, flowSchema string, executionTime time.Duration)
- func ObserveQueueLength(ctx context.Context, priorityLevel, flowSchema string, length int)
- func ObserveWaitingDuration(ctx context.Context, priorityLevel, flowSchema, execute string, waitTime time.Duration)
- func ObserveWatchCount(ctx context.Context, priorityLevel, flowSchema string, count int)
- func ObserveWorkEstimatedSeats(priorityLevel, flowSchema string, seats int)
- func Register()
- func Reset()
- func SetCurrentR(priorityLevel string, r float64)
- func SetDispatchMetrics(priorityLevel string, r, s, sMin, sMax, discountedSMin, discountedSMax float64)
- func SetFairFrac(fairFrac float64)
- func SetPriorityLevelConfiguration(priorityLevel string, nominalCL, minCL, maxCL int)
- type Gauge
- type RatioedGauge
- type RatioedGaugePair
- type RatioedGaugeVec
- type Registerables
- type TimingRatioHistogram
- func NewTestableTimingRatioHistogram(nowFunc func() time.Time, opts *TimingRatioHistogramOpts) *TimingRatioHistogram
- func NewTimingRatioHistogram(opts *TimingRatioHistogramOpts) *TimingRatioHistogram
- func (trh *TimingRatioHistogram) Add(deltaNumerator float64)
- func (trh *TimingRatioHistogram) Dec()
- func (trh *TimingRatioHistogram) Inc()
- func (trh *TimingRatioHistogram) Set(numerator float64)
- func (trh *TimingRatioHistogram) SetDenominator(denominator float64)
- func (trh *TimingRatioHistogram) SetToCurrentTime()
- func (trh *TimingRatioHistogram) Sub(deltaNumerator float64)
- func (trh *TimingRatioHistogram) WithContext(ctx context.Context) RatioedGauge
- type TimingRatioHistogramOpts
- type TimingRatioHistogramVec
- func NewTestableTimingRatioHistogramVec(nowFunc func() time.Time, opts *compbasemetrics.TimingHistogramOpts, labelNames ...string) *TimingRatioHistogramVec
- func NewTimingRatioHistogramVec(opts *compbasemetrics.TimingHistogramOpts, labelNames ...string) *TimingRatioHistogramVec
- func (v *TimingRatioHistogramVec) NewForLabelValuesChecked(initialNumerator, initialDenominator float64, labelValues []string) (RatioedGauge, error)
- func (v *TimingRatioHistogramVec) NewForLabelValuesSafe(initialNumerator, initialDenominator float64, labelValues []string) RatioedGauge
- func (v *TimingRatioHistogramVec) Reset()
Constants ¶
const ( LabelNamePhase = "phase" LabelValueWaiting = "waiting" LabelValueExecuting = "executing" )
Variables ¶
var ( PriorityLevelExecutionSeatsGaugeVec = NewTimingRatioHistogramVec( &compbasemetrics.TimingHistogramOpts{ Namespace: namespace, Subsystem: subsystem, Name: "priority_level_seat_utilization", Help: "" /* 135 byte string literal not displayed */, Buckets: []float64{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99, 1}, ConstLabels: map[string]string{phase: "executing"}, StabilityLevel: compbasemetrics.ALPHA, }, priorityLevel, ) PriorityLevelConcurrencyGaugeVec = NewTimingRatioHistogramVec( &compbasemetrics.TimingHistogramOpts{ Namespace: namespace, Subsystem: subsystem, Name: "priority_level_request_utilization", Help: "" /* 181 byte string literal not displayed */, Buckets: []float64{0, 0.001, 0.003, 0.01, 0.03, 0.1, 0.25, 0.5, 0.75, 1}, StabilityLevel: compbasemetrics.ALPHA, }, LabelNamePhase, priorityLevel, ) ApiserverSeatDemands = NewTimingRatioHistogramVec( &compbasemetrics.TimingHistogramOpts{ Namespace: namespace, Subsystem: subsystem, Name: "demand_seats", Help: "" /* 145 byte string literal not displayed */, Buckets: []float64{0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.7, 2, 2.8, 4, 6}, StabilityLevel: compbasemetrics.ALPHA, }, priorityLevel, ) )
var GetExecutingMutatingConcurrency = executingMutating.getGauge
GetExecutingMutatingConcurrency returns the gauge of number of executing mutating requests / limit on those.
var GetExecutingReadonlyConcurrency = executingReadonly.getGauge
GetExecutingReadonlyConcurrency returns the gauge of number of executing readonly requests / limit on those.
var GetWaitingMutatingConcurrency = waitingMutating.getGauge
GetWaitingMutatingConcurrency returns the gauge of number of mutating requests waiting / limit on those.
var GetWaitingReadonlyConcurrency = waitingReadonly.getGauge
GetWaitingReadonlyConcurrency returns the gauge of number of readonly requests waiting / limit on those.
Functions ¶
func AddDispatch ¶
AddDispatch increments the # of dispatched requests for flow control
func AddDispatchWithNoAccommodation ¶
func AddDispatchWithNoAccommodation(priorityLevel, flowSchema string)
AddDispatchWithNoAccommodation keeps track of number of times dispatch attempt results in a non accommodation due to lack of available seats.
func AddEpochAdvance ¶
AddEpochAdvance notes an advance of the progress meter baseline for a given priority level
func AddReject ¶
AddReject increments the # of rejected requests for flow control
func AddRequestsExecuting ¶
AddRequestsExecuting adds the given delta to the gauge of executing requests of the given flowSchema and priorityLevel
func AddRequestsInQueues ¶
AddRequestsInQueues adds the given delta to the gauge of the # of requests in the queues of the specified flowSchema and priorityLevel
func AddSeatConcurrencyInUse ¶
AddSeatConcurrencyInUse adds the given delta to the gauge of seats in use by the currently executing requests of the given flowSchema and priorityLevel
func AddSeatsInQueues ¶
AddSeatsInQueues adds the given delta to the gauge of the # of seats in the queues of the specified flowSchema and priorityLevel
func GatherAndCompare ¶
GatherAndCompare the given metrics with the given Prometheus syntax expected value
func NotePriorityLevelConcurrencyAdjustment ¶
func NotePriorityLevelConcurrencyAdjustment(priorityLevel string, seatDemandHWM, seatDemandAvg, seatDemandStdev, seatDemandSmoothed, seatDemandTarget float64, currentCL int)
func ObserveExecutionDuration ¶
func ObserveExecutionDuration(ctx context.Context, priorityLevel, flowSchema string, executionTime time.Duration)
ObserveExecutionDuration observes the execution duration for flow control
func ObserveQueueLength ¶
ObserveQueueLength observes the queue length for flow control
func ObserveWaitingDuration ¶
func ObserveWaitingDuration(ctx context.Context, priorityLevel, flowSchema, execute string, waitTime time.Duration)
ObserveWaitingDuration observes the queue length for flow control
func ObserveWatchCount ¶
ObserveWatchCount notes a sampling of a watch count
func ObserveWorkEstimatedSeats ¶
ObserveWorkEstimatedSeats notes a sampling of estimated seats associated with a request
func Register ¶
func Register()
Register all metrics.
func Reset ¶
func Reset()
Reset all resettable metrics to zero
func SetCurrentR ¶
SetCurrentR sets the current-R (virtualTime) gauge for the given priority level
func SetDispatchMetrics ¶
func SetDispatchMetrics(priorityLevel string, r, s, sMin, sMax, discountedSMin, discountedSMax float64)
SetLatestS sets the latest-S (virtual time of dispatched request) gauge for the given priority level
func SetFairFrac ¶
func SetFairFrac(fairFrac float64)
func SetPriorityLevelConfiguration ¶
Types ¶
type Gauge ¶
Gauge is the methods of a gauge that are used by instrumented code.
func NewUnionGauge ¶
NewUnionGauge constructs a Gauge that delegates to all of the given Gauges
type RatioedGauge ¶
type RatioedGauge interface { Gauge // SetDenominator sets the denominator to use until it is changed again SetDenominator(float64) }
RatioedGauge tracks ratios. The numerator is set/changed through the Gauge methods, and the denominator can be updated through the SetDenominator method. A ratio is tracked whenever the numerator or denominator is set/changed.
type RatioedGaugePair ¶
type RatioedGaugePair struct { // RequestsWaiting is given observations of the number of currently queued requests RequestsWaiting RatioedGauge // RequestsExecuting is given observations of the number of requests currently executing RequestsExecuting RatioedGauge }
RatioedGaugePair is a corresponding pair of gauges, one for the number of requests waiting in queue(s) and one for the number of requests being executed.
func RatioedGaugeVecPhasedElementPair ¶
func RatioedGaugeVecPhasedElementPair(vec RatioedGaugeVec, initialWaitingDenominator, initialExecutingDenominator float64, labelValues []string) RatioedGaugePair
RatioedGaugeVecPhasedElementPair extracts a pair of elements that differ in handling phase
type RatioedGaugeVec ¶
type RatioedGaugeVec interface { // NewForLabelValuesSafe makes a new vector member for the given tuple of label values, // initialized with the given numerator and denominator. // Unlike the usual Vec WithLabelValues method, this is intended to be called only // once per vector member (at the start of its lifecycle). // The "Safe" part is saying that the returned object will function properly after metric registration // even if this method is called before registration. NewForLabelValuesSafe(initialNumerator, initialDenominator float64, labelValues []string) RatioedGauge }
RatioedGaugeVec creates related observers that are differentiated by a series of label values
type Registerables ¶
type Registerables []compbasemetrics.Registerable
Registerables is a slice of Registerable
func (Registerables) Append ¶
func (rs Registerables) Append(more ...compbasemetrics.Registerable) Registerables
Append adds more
type TimingRatioHistogram ¶
type TimingRatioHistogram struct { // Registerable is the registerable aspect. // That is the registerable aspect of the underlying TimingHistogram. compbasemetrics.Registerable // contains filtered or unexported fields }
TimingRatioHistogram is essentially a gauge for a ratio where the client independently controls the numerator and denominator. When scraped it produces a histogram of samples of the ratio taken at the end of every nanosecond. `*TimingRatioHistogram` implements both Registerable and RatioedGauge.
func NewTestableTimingRatioHistogram ¶
func NewTestableTimingRatioHistogram(nowFunc func() time.Time, opts *TimingRatioHistogramOpts) *TimingRatioHistogram
NewTestableTimingHistogram adds injection of the clock
func NewTimingRatioHistogram ¶
func NewTimingRatioHistogram(opts *TimingRatioHistogramOpts) *TimingRatioHistogram
NewTimingHistogram returns an object which is TimingHistogram-like. However, nothing will be measured until the histogram is registered in at least one registry.
func (*TimingRatioHistogram) Add ¶
func (trh *TimingRatioHistogram) Add(deltaNumerator float64)
func (*TimingRatioHistogram) Dec ¶
func (trh *TimingRatioHistogram) Dec()
func (*TimingRatioHistogram) Inc ¶
func (trh *TimingRatioHistogram) Inc()
func (*TimingRatioHistogram) Set ¶
func (trh *TimingRatioHistogram) Set(numerator float64)
func (*TimingRatioHistogram) SetDenominator ¶
func (trh *TimingRatioHistogram) SetDenominator(denominator float64)
func (*TimingRatioHistogram) SetToCurrentTime ¶
func (trh *TimingRatioHistogram) SetToCurrentTime()
func (*TimingRatioHistogram) Sub ¶
func (trh *TimingRatioHistogram) Sub(deltaNumerator float64)
func (*TimingRatioHistogram) WithContext ¶
func (trh *TimingRatioHistogram) WithContext(ctx context.Context) RatioedGauge
WithContext allows the normal TimingHistogram metric to pass in context. The context is no-op at the current level of development.
type TimingRatioHistogramOpts ¶
type TimingRatioHistogramOpts struct { compbasemetrics.TimingHistogramOpts InitialDenominator float64 }
TimingRatioHistogramOpts is the constructor parameters of a TimingRatioHistogram. The `TimingHistogramOpts.InitialValue` is the initial numerator.
type TimingRatioHistogramVec ¶
type TimingRatioHistogramVec struct { // promote only the Registerable methods compbasemetrics.Registerable // contains filtered or unexported fields }
TimingRatioHistogramVec is a collection of TimingRatioHistograms that differ only in label values. `*TimingRatioHistogramVec` implements both Registerable and RatioedGaugeVec.
func NewTestableTimingRatioHistogramVec ¶
func NewTestableTimingRatioHistogramVec(nowFunc func() time.Time, opts *compbasemetrics.TimingHistogramOpts, labelNames ...string) *TimingRatioHistogramVec
NewTestableTimingHistogramVec adds injection of the clock.
func NewTimingRatioHistogramVec ¶
func NewTimingRatioHistogramVec(opts *compbasemetrics.TimingHistogramOpts, labelNames ...string) *TimingRatioHistogramVec
NewTimingHistogramVec constructs a new vector. `opts.InitialValue` is the initial ratio, but this applies only for the tiny period of time until NewForLabelValuesSafe sets the ratio based on the given initial numerator and denominator. Thus there is a tiny splinter of time during member construction when its underlying TimingHistogram is given the initial numerator rather than the initial ratio (which is obviously a non-issue when both are zero). Note the difficulties associated with extracting a member before registering the vector.
func (*TimingRatioHistogramVec) NewForLabelValuesChecked ¶
func (v *TimingRatioHistogramVec) NewForLabelValuesChecked(initialNumerator, initialDenominator float64, labelValues []string) (RatioedGauge, error)
NewForLabelValuesChecked will return an error if this vec is not hidden and not yet registered or there is a syntactic problem with the labelValues.
func (*TimingRatioHistogramVec) NewForLabelValuesSafe ¶
func (v *TimingRatioHistogramVec) NewForLabelValuesSafe(initialNumerator, initialDenominator float64, labelValues []string) RatioedGauge
NewForLabelValuesSafe is the same as NewForLabelValuesChecked in cases where that does not return an error. When the unsafe version returns an error due to the vector not being registered yet, the safe version returns an object that implements its methods by looking up the relevant vector member in each call (thus getting a non-noop after registration). In the other error cases the object returned here is a noop.
func (*TimingRatioHistogramVec) Reset ¶
func (v *TimingRatioHistogramVec) Reset()
Source Files ¶
interface.go metrics.go timing_ratio_histogram.go union_gauge.go vec_element_pair.go
- Version
- v0.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 1 hour ago –
Tools for package owners.