string dumps a text representation of a sample. Intended mainly for debugging purposes.
()
| 660 | // string dumps a text representation of a sample. Intended mainly |
| 661 | // for debugging purposes. |
| 662 | func (s *Sample) string() string { |
| 663 | ss := []string{} |
| 664 | var sv string |
| 665 | for _, v := range s.Value { |
| 666 | sv = fmt.Sprintf("%s %10d", sv, v) |
| 667 | } |
| 668 | sv = sv + ": " |
| 669 | for _, l := range s.Location { |
| 670 | sv = sv + fmt.Sprintf("%d ", l.ID) |
| 671 | } |
| 672 | ss = append(ss, sv) |
| 673 | const labelHeader = " " |
| 674 | if len(s.Label) > 0 { |
| 675 | ss = append(ss, labelHeader+labelsToString(s.Label)) |
| 676 | } |
| 677 | if len(s.NumLabel) > 0 { |
| 678 | ss = append(ss, labelHeader+numLabelsToString(s.NumLabel, s.NumUnit)) |
| 679 | } |
| 680 | return strings.Join(ss, "\n") |
| 681 | } |
| 682 | |
| 683 | // labelsToString returns a string representation of a |
| 684 | // map representing labels. |
no test coverage detected