formatLabelValues returns all the string and numeric labels in Sample, with the numeric labels formatted according to outputUnit.
(s *profile.Sample, k string, outputUnit string)
| 113 | // formatLabelValues returns all the string and numeric labels in Sample, with |
| 114 | // the numeric labels formatted according to outputUnit. |
| 115 | func formatLabelValues(s *profile.Sample, k string, outputUnit string) []string { |
| 116 | var values []string |
| 117 | values = append(values, s.Label[k]...) |
| 118 | numLabels := s.NumLabel[k] |
| 119 | numUnits := s.NumUnit[k] |
| 120 | if len(numLabels) != len(numUnits) && len(numUnits) != 0 { |
| 121 | return values |
| 122 | } |
| 123 | for i, numLabel := range numLabels { |
| 124 | var value string |
| 125 | if len(numUnits) != 0 { |
| 126 | value = measurement.ScaledLabel(numLabel, numUnits[i], outputUnit) |
| 127 | } else { |
| 128 | value = measurement.ScaledLabel(numLabel, "", "") |
| 129 | } |
| 130 | values = append(values, value) |
| 131 | } |
| 132 | return values |
| 133 | } |
no test coverage detected
searching dependent graphs…