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

Method Update

coderd/prometheusmetrics/aggregator.go:505–521  ·  view source on GitHub ↗
(ctx context.Context, labels AgentMetricLabels, metrics []*agentproto.Stats_Metric)

Source from the content-addressed store, hash-verified

503}
504
505func (ma *MetricsAggregator) Update(ctx context.Context, labels AgentMetricLabels, metrics []*agentproto.Stats_Metric) {
506 select {
507 case ma.updateCh <- updateRequest{
508 username: labels.Username,
509 workspaceName: labels.WorkspaceName,
510 agentName: labels.AgentName,
511 templateName: labels.TemplateName,
512 metrics: metrics,
513
514 timestamp: ma.clock.Now(),
515 }:
516 case <-ctx.Done():
517 ma.log.Debug(ctx, "update request is canceled")
518 default:
519 ma.log.Error(ctx, "update queue is full")
520 }
521}
522
523// Move to a function for testability
524func (ma *MetricsAggregator) cleanupDescCache() {

Calls 2

DoneMethod · 0.45
ErrorMethod · 0.45

Tested by 3

TestLabelsAggregationFunction · 0.76