* a set of functions to format container stats */
(noTrunc bool)
| 149 | a set of functions to format container stats |
| 150 | */ |
| 151 | func (s *StatsEntry) EntryName(noTrunc bool) string { |
| 152 | if len(s.Name) > 1 { |
| 153 | if !noTrunc { |
| 154 | var truncLen int |
| 155 | if strings.HasPrefix(s.Name, "k8s://") { |
| 156 | truncLen = 24 |
| 157 | } else { |
| 158 | truncLen = 12 |
| 159 | } |
| 160 | if len(s.Name) > truncLen { |
| 161 | return s.Name[:truncLen] |
| 162 | } |
| 163 | } |
| 164 | return s.Name |
| 165 | } |
| 166 | return "--" |
| 167 | } |
| 168 | |
| 169 | func (s *StatsEntry) EntryID(noTrunc bool) string { |
| 170 | if !noTrunc { |