package metrics
import "k8s.io/apiserver/pkg/util/flowcontrol/metrics"
Index ¶
- 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 AddRequestConcurrencyInUse(priorityLevel, flowSchema string, delta int)
- func AddRequestsExecuting(ctx context.Context, priorityLevel, flowSchema string, delta int)
- func AddRequestsInQueues(ctx context.Context, priorityLevel, flowSchema string, delta int)
- func GatherAndCompare(expected string, metricNames ...string) error
- 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 UpdateSharedConcurrencyLimit(priorityLevel string, limit int)
- type ChangeObserver
- type Observer
- type RatioedChangeObserver
- type RatioedChangeObserverGenerator
- type RatioedChangeObserverPair
- type RatioedChangeObserverPairGenerator
- type Registerables
- type SampleAndWaterMarkObserverGenerator
- func NewSampleAndWaterMarkHistogramsGenerator(clock clock.PassiveClock, samplePeriod time.Duration, sampleOpts, waterMarkOpts *compbasemetrics.HistogramOpts, labelNames []string) SampleAndWaterMarkObserverGenerator
- func (swg SampleAndWaterMarkObserverGenerator) Generate(initialNumerator, initialDenominator float64, labelValues []string) RatioedChangeObserver
- type SampleAndWaterMarkPairGenerator
- func NewSampleAndWaterMarkHistogramsPairGenerator(clock clock.PassiveClock, samplePeriod time.Duration, sampleOpts, waterMarkOpts *compbasemetrics.HistogramOpts, labelNames []string) SampleAndWaterMarkPairGenerator
- func (spg SampleAndWaterMarkPairGenerator) Generate(initialWaitingDenominator, initialExecutingDenominator float64, labelValues []string) RatioedChangeObserverPair
Variables ¶
var ( // PriorityLevelExecutionSeatsObserverGenerator creates observers of seats occupied throughout execution for priority levels PriorityLevelExecutionSeatsObserverGenerator = NewSampleAndWaterMarkHistogramsGenerator(clock.RealClock{}, time.Millisecond, &compbasemetrics.HistogramOpts{ Namespace: namespace, Subsystem: subsystem, Name: "priority_level_seat_count_samples", Help: "Periodic observations of number of seats occupied for any stage of execution (but only initial stage for WATCHes)", Buckets: []float64{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1}, ConstLabels: map[string]string{phase: "executing"}, StabilityLevel: compbasemetrics.ALPHA, }, &compbasemetrics.HistogramOpts{ Namespace: namespace, Subsystem: subsystem, Name: "priority_level_seat_count_watermarks", Help: "Watermarks of the number of seats occupied for any stage of execution (but only initial stage for WATCHes)", Buckets: []float64{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1}, ConstLabels: map[string]string{phase: "executing"}, StabilityLevel: compbasemetrics.ALPHA, }, []string{priorityLevel}, ) // PriorityLevelConcurrencyObserverPairGenerator creates pairs that observe concurrency for priority levels PriorityLevelConcurrencyObserverPairGenerator = NewSampleAndWaterMarkHistogramsPairGenerator(clock.RealClock{}, time.Millisecond, &compbasemetrics.HistogramOpts{ Namespace: namespace, Subsystem: subsystem, Name: "priority_level_request_count_samples", Help: "Periodic observations of the number of requests waiting or in any stage of execution (but only initial stage for WATCHes)", Buckets: []float64{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1}, StabilityLevel: compbasemetrics.ALPHA, }, &compbasemetrics.HistogramOpts{ Namespace: namespace, Subsystem: subsystem, Name: "priority_level_request_count_watermarks", Help: "Watermarks of the number of requests waiting or in any stage of execution (but only initial stage for WATCHes)", Buckets: []float64{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1}, StabilityLevel: compbasemetrics.ALPHA, }, []string{priorityLevel}, ) // ReadWriteConcurrencyObserverPairGenerator creates pairs that observe concurrency broken down by mutating vs readonly ReadWriteConcurrencyObserverPairGenerator = NewSampleAndWaterMarkHistogramsPairGenerator(clock.RealClock{}, time.Millisecond, &compbasemetrics.HistogramOpts{ Namespace: namespace, Subsystem: subsystem, Name: "read_vs_write_request_count_samples", Help: "Periodic observations of the number of requests waiting or in regular stage of execution", Buckets: []float64{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1}, StabilityLevel: compbasemetrics.ALPHA, }, &compbasemetrics.HistogramOpts{ Namespace: namespace, Subsystem: subsystem, Name: "read_vs_write_request_count_watermarks", Help: "Watermarks of the number of requests waiting or in regular stage of execution", Buckets: []float64{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1}, StabilityLevel: compbasemetrics.ALPHA, }, []string{requestKind}, ) )
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 AddRequestConcurrencyInUse ¶
AddRequestConcurrencyInUse adds the given delta to the gauge of concurrency in use by the currently executing requests of the given flowSchema and priorityLevel
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 GatherAndCompare ¶
GatherAndCompare the given metrics with the given Prometheus syntax expected value
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 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 UpdateSharedConcurrencyLimit ¶
UpdateSharedConcurrencyLimit updates the value for the concurrency limit in flow control
Types ¶
type ChangeObserver ¶
type ChangeObserver interface { Observer // Observe a new value that differs by the given amount from the previous observation. Add(float64) }
ChangeObserver extends Observer with the ability to take
an observation that is relative to the previous observation.
type Observer ¶
type Observer interface { // Observe takes an observation Observe(float64) }
Observer is something that can be given numeric observations.
type RatioedChangeObserver ¶
type RatioedChangeObserver interface { ChangeObserver // SetDenominator sets the denominator to use until it is changed again SetDenominator(float64) }
RatioedChangeObserver tracks ratios. The numerator is set/changed through the ChangeObserver methods, and the denominator can be updated through the SetDenominator method. A ratio is tracked whenever the numerator is set/changed.
type RatioedChangeObserverGenerator ¶
type RatioedChangeObserverGenerator interface { Generate(initialNumerator, initialDenominator float64, labelValues []string) RatioedChangeObserver }
RatioedChangeObserverGenerator creates related observers that are differentiated by a series of label values
type RatioedChangeObserverPair ¶
type RatioedChangeObserverPair struct { // RequestsWaiting is given observations of the number of currently queued requests RequestsWaiting RatioedChangeObserver // RequestsExecuting is given observations of the number of requests currently executing RequestsExecuting RatioedChangeObserver }
RatioedChangeObserverPair is a corresponding pair of observers, one for the number of requests waiting in queue(s) and one for the number of requests being executed
type RatioedChangeObserverPairGenerator ¶
type RatioedChangeObserverPairGenerator interface { Generate(initialWaitingDenominator, initialExecutingDenominator float64, labelValues []string) RatioedChangeObserverPair }
RatioedChangeObserverPairGenerator generates pairs
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 SampleAndWaterMarkObserverGenerator ¶
type SampleAndWaterMarkObserverGenerator struct {
// contains filtered or unexported fields
}
SampleAndWaterMarkObserverGenerator creates RatioedChangeObservers that populate histograms of samples and low- and high-water-marks. The generator has a samplePeriod, and the histograms get an observation every samplePeriod. The sampling windows are quantized based on the monotonic rather than wall-clock times. The `t0` field is there so to provide a baseline for monotonic clock differences.
func NewSampleAndWaterMarkHistogramsGenerator ¶
func NewSampleAndWaterMarkHistogramsGenerator(clock clock.PassiveClock, samplePeriod time.Duration, sampleOpts, waterMarkOpts *compbasemetrics.HistogramOpts, labelNames []string) SampleAndWaterMarkObserverGenerator
NewSampleAndWaterMarkHistogramsGenerator makes a new one
func (SampleAndWaterMarkObserverGenerator) Generate ¶
func (swg SampleAndWaterMarkObserverGenerator) Generate(initialNumerator, initialDenominator float64, labelValues []string) RatioedChangeObserver
Generate makes a new RatioedChangeObserver
type SampleAndWaterMarkPairGenerator ¶
type SampleAndWaterMarkPairGenerator struct {
// contains filtered or unexported fields
}
SampleAndWaterMarkPairGenerator makes pairs of RatioedChangeObservers that track samples and watermarks.
func NewSampleAndWaterMarkHistogramsPairGenerator ¶
func NewSampleAndWaterMarkHistogramsPairGenerator(clock clock.PassiveClock, samplePeriod time.Duration, sampleOpts, waterMarkOpts *compbasemetrics.HistogramOpts, labelNames []string) SampleAndWaterMarkPairGenerator
NewSampleAndWaterMarkHistogramsPairGenerator makes a new pair generator
func (SampleAndWaterMarkPairGenerator) Generate ¶
func (spg SampleAndWaterMarkPairGenerator) Generate(initialWaitingDenominator, initialExecutingDenominator float64, labelValues []string) RatioedChangeObserverPair
Generate makes a new pair
Source Files ¶
metrics.go observer.go sample_and_watermark.go
- Version
- v0.24.1
- Published
- May 26, 2022
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 11 minutes ago –
Tools for package owners.