package metrics
import "k8s.io/apiserver/pkg/util/flowcontrol/metrics"
Index ¶
- Variables
- func AddDispatch(ctx context.Context, priorityLevel, flowSchema string)
- 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 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 Registerables
- type SampleAndWaterMarkObserverGenerator
- func NewSampleAndWaterMarkHistogramsGenerator(clock clock.PassiveClock, samplePeriod time.Duration, sampleOpts, waterMarkOpts *compbasemetrics.HistogramOpts, labelNames []string) SampleAndWaterMarkObserverGenerator
- func (swg SampleAndWaterMarkObserverGenerator) Generate(x, x1 float64, labelValues []string) TimedObserver
- type SampleAndWaterMarkPairGenerator
- func NewSampleAndWaterMarkHistogramsPairGenerator(clock clock.PassiveClock, samplePeriod time.Duration, sampleOpts, waterMarkOpts *compbasemetrics.HistogramOpts, labelNames []string) SampleAndWaterMarkPairGenerator
- func (spg SampleAndWaterMarkPairGenerator) Generate(waiting1, executing1 float64, labelValues []string) TimedObserverPair
- type TimedObserver
- type TimedObserverGenerator
- type TimedObserverPair
- type TimedObserverPairGenerator
Variables ¶
var ( // 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", 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", 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", 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", 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 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 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 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 TimedObservers 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(x, x1 float64, labelValues []string) TimedObserver
Generate makes a new TimedObserver
type SampleAndWaterMarkPairGenerator ¶
type SampleAndWaterMarkPairGenerator struct {
// contains filtered or unexported fields
}
SampleAndWaterMarkPairGenerator makes pairs of TimedObservers 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(waiting1, executing1 float64, labelValues []string) TimedObserverPair
Generate makes a new pair
type TimedObserver ¶
type TimedObserver interface { // Add notes a change to the variable Add(deltaX float64) // Set notes a setting of the variable Set(x float64) // SetX1 changes the value to use for X1 SetX1(x1 float64) }
TimedObserver gets informed about the values assigned to a variable `X float64` over time, and reports on the ratio `X/X1`.
type TimedObserverGenerator ¶
type TimedObserverGenerator interface { Generate(x, x1 float64, labelValues []string) TimedObserver }
TimedObserverGenerator creates related observers that are differentiated by a series of label values
type TimedObserverPair ¶
type TimedObserverPair struct { // RequestsWaiting is given observations of the number of currently queued requests RequestsWaiting TimedObserver // RequestsExecuting is given observations of the number of requests currently executing RequestsExecuting TimedObserver }
TimedObserverPair 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 TimedObserverPairGenerator ¶
type TimedObserverPairGenerator interface { Generate(waiting1, executing1 float64, labelValues []string) TimedObserverPair }
TimedObserverPairGenerator generates pairs
Source Files ¶
metrics.go sample_and_watermark.go timed_observer.go
- Version
- v0.22.15
- Published
- Sep 21, 2022
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- 1 second ago –
Tools for package owners.