private static string FormatMetricsBody(MetricEvent metrics) { if (metrics.IsError) { var error = metrics.Error; return(error.GetType().Name + ": " + error.Message); } var jobIdFormatLength = metrics.JobIds.Max(id => id.Length); var jobInfos = metrics.JobIds.Select(id => FormatJobMetrics(id, metrics.GetMetrics(id), jobIdFormatLength)); return(String.Join(Environment.NewLine, jobInfos)); }