MCPcopy Index your code
hub / github.com/prometheus/prometheus / queueActive

Method queueActive

promql/engine.go:768–776  ·  view source on GitHub ↗

Log query in active log. The active log guarantees that we don't run over MaxConcurrent queries.

(ctx context.Context, q *query)

Source from the content-addressed store, hash-verified

766// Log query in active log. The active log guarantees that we don't run over
767// MaxConcurrent queries.
768func (ng *Engine) queueActive(ctx context.Context, q *query) (func(), error) {
769 if ng.activeQueryTracker == nil {
770 return func() {}, nil
771 }
772 queueSpanTimer, _ := q.stats.GetSpanTimer(ctx, stats.ExecQueueTime, ng.metrics.queryQueueTime, ng.metrics.queryQueueTimeHistogram)
773 queryIndex, err := ng.activeQueryTracker.Insert(ctx, q.q)
774 queueSpanTimer.Finish()
775 return func() { ng.activeQueryTracker.Delete(queryIndex) }, err
776}
777
778func timeMilliseconds(t time.Time) int64 {
779 return t.UnixNano() / int64(time.Millisecond/time.Nanosecond)

Callers 3

NewInstantQueryMethod · 0.95
NewRangeQueryMethod · 0.95
execMethod · 0.95

Calls 4

GetSpanTimerMethod · 0.80
FinishMethod · 0.80
InsertMethod · 0.65
DeleteMethod · 0.65

Tested by

no test coverage detected