func formatMemory(m report.Metric) (report.Metric, string) { s := m.LastSample() if s == nil { return m, "" } human, divisor := memoryScale(s.Value) return m.Div(divisor), fmt.Sprintf("%0.2f %s", s.Value/divisor, human) }
func formatPercent(m report.Metric) (report.Metric, string) { if s := m.LastSample(); s != nil { return m, fmt.Sprintf("%0.2f%%", s.Value) } return m, "" }