MCPcopy Index your code
hub / github.com/coder/coder / Collect

Method Collect

coderd/prometheusmetrics/aggregator.go:488–503  ·  view source on GitHub ↗
(ch chan<- prometheus.Metric)

Source from the content-addressed store, hash-verified

486}
487
488func (ma *MetricsAggregator) Collect(ch chan<- prometheus.Metric) {
489 output := make(chan []prometheus.Metric, 1)
490
491 select {
492 case ma.collectCh <- output:
493 default:
494 ma.log.Error(context.Background(), "collect queue is full")
495 return
496 }
497
498 for s := range output {
499 for _, m := range s {
500 ch <- m
501 }
502 }
503}
504
505func (ma *MetricsAggregator) Update(ctx context.Context, labels AgentMetricLabels, metrics []*agentproto.Stats_Metric) {
506 select {

Calls 1

ErrorMethod · 0.45

Tested by 3

TestLabelsAggregationFunction · 0.76