MCPcopy Create free account
hub / github.com/flant/shell-operator / runQueueLengthMetric

Method runQueueLengthMetric

pkg/shell-operator/operator.go:1025–1040  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1023}
1024
1025func (op *ShellOperator) runQueueLengthMetric() {
1026 defer op.wg.Done()
1027 ticker := time.NewTicker(5 * time.Second)
1028 defer ticker.Stop()
1029 for {
1030 select {
1031 case <-op.ctx.Done():
1032 return
1033 case <-ticker.C:
1034 op.TaskQueues.IterateSnapshot(op.ctx, func(_ context.Context, q *queue.TaskQueue) {
1035 op.MetricStorage.GaugeSet(metrics.TasksQueueLength, float64(q.Length()),
1036 map[string]string{pkg.MetricKeyQueue: q.Name})
1037 })
1038 }
1039 }
1040}
1041
1042// initAndStartHookQueues create all queues defined in hooks
1043func (op *ShellOperator) initAndStartHookQueues() {

Callers 1

runMetricsMethod · 0.95

Calls 4

StopMethod · 0.65
IterateSnapshotMethod · 0.45
GaugeSetMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected