AddToLabels adds metric schema metadata as labels into the labels.ScratchBuilder. Empty Metadata fields will be ignored (not added).
(b *labels.ScratchBuilder)
| 103 | // AddToLabels adds metric schema metadata as labels into the labels.ScratchBuilder. |
| 104 | // Empty Metadata fields will be ignored (not added). |
| 105 | func (m Metadata) AddToLabels(b *labels.ScratchBuilder) { |
| 106 | if m.Name != "" { |
| 107 | b.Add(model.MetricNameLabel, m.Name) |
| 108 | } |
| 109 | if !m.IsTypeEmpty() { |
| 110 | b.Add(model.MetricTypeLabel, string(m.Type)) |
| 111 | } |
| 112 | if m.Unit != "" { |
| 113 | b.Add(model.MetricUnitLabel, m.Unit) |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | // SetToLabels injects metric schema metadata as labels into the labels.Builder. |
| 118 | // It follows the labels.Builder.Set semantics, so empty Metadata fields will |