MCPcopy Create free account
hub / github.com/cortexproject/cortex / FromLabelPairsToLabels

Function FromLabelPairsToLabels

pkg/util/metrics_helper.go:735–741  ·  view source on GitHub ↗

FromLabelPairsToLabels converts dto.LabelPair into labels.Labels.

(pairs []*dto.LabelPair)

Source from the content-addressed store, hash-verified

733
734// FromLabelPairsToLabels converts dto.LabelPair into labels.Labels.
735func FromLabelPairsToLabels(pairs []*dto.LabelPair) labels.Labels {
736 builder := labels.NewBuilder(labels.EmptyLabels())
737 for _, pair := range pairs {
738 builder.Set(pair.GetName(), pair.GetValue())
739 }
740 return builder.Labels()
741}
742
743// GetSumOfHistogramSampleCount returns the sum of samples count of histograms matching the provided metric name
744// and optional label matchers. Returns 0 if no metric matches.

Callers 1

Calls 4

SetMethod · 0.65
GetNameMethod · 0.45
GetValueMethod · 0.45
LabelsMethod · 0.45

Tested by

no test coverage detected