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

Function asMetricAgentLabels

coderd/prometheusmetrics/aggregator_test.go:252–265  ·  view source on GitHub ↗
(dtoLabels []*dto.LabelPair)

Source from the content-addressed store, hash-verified

250}
251
252func asMetricAgentLabels(dtoLabels []*dto.LabelPair) []*agentproto.Stats_Metric_Label {
253 metricLabels := make([]*agentproto.Stats_Metric_Label, 0, len(dtoLabels))
254 for _, dtoLabel := range dtoLabels {
255 if dtoLabel.GetValue() == "" {
256 continue
257 }
258
259 metricLabels = append(metricLabels, &agentproto.Stats_Metric_Label{
260 Name: dtoLabel.GetName(),
261 Value: dtoLabel.GetValue(),
262 })
263 }
264 return metricLabels
265}
266
267func TestUpdateMetrics_MetricsExpire(t *testing.T) {
268 t.Parallel()

Callers 2

verifyCollectedMetricsFunction · 0.85
prometheusMetricToStringFunction · 0.85

Calls 2

GetValueMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected