UnsafeMetricNameFromLabelAdapters extracts the metric name from a list of LabelPairs. The returned metric name string is a reference to the label value (no copy).
(labels []cortexpb.LabelAdapter)
| 29 | // UnsafeMetricNameFromLabelAdapters extracts the metric name from a list of LabelPairs. |
| 30 | // The returned metric name string is a reference to the label value (no copy). |
| 31 | func UnsafeMetricNameFromLabelAdapters(labels []cortexpb.LabelAdapter) (string, error) { |
| 32 | for _, label := range labels { |
| 33 | if label.Name == model.MetricNameLabel { |
| 34 | return label.Value, nil |
| 35 | } |
| 36 | } |
| 37 | return "", errNoMetricNameLabel |
| 38 | } |
| 39 | |
| 40 | // MetricNameFromMetric extract the metric name from a model.Metric |
| 41 | func MetricNameFromMetric(m model.Metric) (model.LabelValue, error) { |
no outgoing calls
no test coverage detected