Documentation ¶
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 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, ...)
- func ObserveQueueLength(ctx context.Context, priorityLevel, flowSchema string, length int)
- func ObserveWaitingDuration(ctx context.Context, priorityLevel, flowSchema, execute string, ...)
- 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 Gauge
- type RatioedGauge
- type RatioedGaugePair
- type RatioedGaugeVec
- type Registerables
- type SampleAndWaterMarkObserverVec
Constants ¶
const ( LabelNamePhase = "phase" LabelValueWaiting = "waiting" LabelValueExecuting = "executing" )
Variables ¶
var ( // PriorityLevelExecutionSeatsGaugeVec creates observers of seats occupied throughout execution for priority levels PriorityLevelExecutionSeatsGaugeVec = NewSampleAndWaterMarkHistogramsVec(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}, ) // PriorityLevelConcurrencyGaugeVec creates gauges of concurrency broken down by phase, priority level PriorityLevelConcurrencyGaugeVec = NewSampleAndWaterMarkHistogramsVec(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{LabelNamePhase, priorityLevel}, ) // ReadWriteConcurrencyGaugeVec creates gauges of number of requests broken down by phase and mutating vs readonly ReadWriteConcurrencyGaugeVec = NewSampleAndWaterMarkHistogramsVec(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{LabelNamePhase, requestKind}, ) )
Functions ¶
func AddDispatch ¶ added in v0.18.0
AddDispatch increments the # of dispatched requests for flow control
func AddDispatchWithNoAccommodation ¶ added in v0.24.0
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 ¶ added in v0.23.0
AddEpochAdvance notes an advance of the progress meter baseline for a given priority level
func AddRequestConcurrencyInUse ¶ added in v0.22.0
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 ¶ added in v0.18.0
AddRequestsExecuting adds the given delta to the gauge of executing requests of the given flowSchema and priorityLevel
func AddRequestsInQueues ¶ added in v0.18.0
AddRequestsInQueues adds the given delta to the gauge of the # of requests in the queues of the specified flowSchema and priorityLevel
func GatherAndCompare ¶ added in v0.18.0
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 ¶ added in v0.23.0
ObserveWatchCount notes a sampling of a watch count
func ObserveWorkEstimatedSeats ¶ added in v0.24.0
ObserveWorkEstimatedSeats notes a sampling of estimated seats associated with a request
func SetCurrentR ¶ added in v0.22.0
SetCurrentR sets the current-R (virtualTime) gauge for the given priority level
func SetDispatchMetrics ¶ added in v0.22.0
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 RatioedGauge ¶ added in v0.25.0
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 ¶ added in v0.25.0
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 ¶ added in v0.25.0
func RatioedGaugeVecPhasedElementPair(vec RatioedGaugeVec, initialWaitingDenominator, initialExecutingDenominator float64, labelValues []string) RatioedGaugePair
RatioedGaugeVecPhasedElementPair extracts a pair of elements that differ in handling phase
type RatioedGaugeVec ¶ added in v0.25.0
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 ¶ added in v0.19.0
type Registerables []compbasemetrics.Registerable
Registerables is a slice of Registerable
func (Registerables) Append ¶ added in v0.19.0
func (rs Registerables) Append(more ...compbasemetrics.Registerable) Registerables
Append adds more
type SampleAndWaterMarkObserverVec ¶
type SampleAndWaterMarkObserverVec struct {
// contains filtered or unexported fields
}
SampleAndWaterMarkObserverVec creates RatioedGauges 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 NewSampleAndWaterMarkHistogramsVec ¶
func NewSampleAndWaterMarkHistogramsVec(clock clock.PassiveClock, samplePeriod time.Duration, sampleOpts, waterMarkOpts *compbasemetrics.HistogramOpts, labelNames []string) SampleAndWaterMarkObserverVec
NewSampleAndWaterMarkHistogramsVec makes a new one
func (SampleAndWaterMarkObserverVec) NewForLabelValuesSafe ¶
func (swg SampleAndWaterMarkObserverVec) NewForLabelValuesSafe(initialNumerator, initialDenominator float64, labelValues []string) RatioedGauge
NewForLabelValuesSafe makes a new RatioedGauge