public static string CreateTableForIISRequestsDistribution(CloudStorageAccount storageAccount, string containerName, List <string> datesInWeek) { StringBuilder sb = new StringBuilder(); string fontOpenTag = @"<b><span style='font-size:11.0pt;font-family:'Calibri','sans-serif';color:windowtext'>"; string fontCloseTag = @"</span></b>"; string cellOpenTag1 = @"<td width=200 valign=top style='width:200pt;border:solid #8EAADB 1.0pt;border-bottom:solid #8EAADB 1.5pt;padding:0in 5.4pt 0in 5.4pt'>"; string cellOpenTag2 = @"<td width=175 valign=top style='width:175pt;border:solid #8EAADB 1.0pt;border-bottom:solid #8EAADB 1.5pt;padding:0in 5.4pt 0in 5.4pt'>"; sb.Append(@"<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 style='border-collapse:collapse'>"); sb.Append(@"<tr>" + cellOpenTag1 + fontOpenTag + "Scenario Name" + fontCloseTag + "</td>"); sb.Append(cellOpenTag2 + fontOpenTag + "# of Requests" + fontCloseTag + "</td>"); sb.Append(cellOpenTag2 + fontOpenTag + "Avg Time Taken in ms" + fontCloseTag + "</td></tr>"); var content = ReportHelpers.Load(storageAccount, "Configration.IISRequestStems.json", containerName); List <IISRequestDetails> UriStems = new List <IISRequestDetails>(); UriStems = new JavaScriptSerializer().Deserialize <List <IISRequestDetails> >(content); foreach (IISRequestDetails stem in UriStems) { int avgTime = 0; int requestCount = ReportHelpers.GetQueryNumbers(stem.ScenarioName, out avgTime, datesInWeek, storageAccount, containerName); sb.Append(@"<tr>" + cellOpenTag1); sb.Append(stem.ScenarioName); sb.Append(@"</td>" + cellOpenTag2); sb.Append(Convert.ToInt64(requestCount).ToString("#,##0")); sb.Append(@"</td>" + cellOpenTag2); sb.Append(Convert.ToInt64(avgTime).ToString("#,##0")); sb.Append("</td></tr>"); } sb.Append("</table>"); return(sb.ToString()); }
/// <summary> /// Given a list of blob names, this function returns a list of key values and another list of aggregated values for those keys /// For example, combined install, install-dependency counts for 2.4 /// </summary> /// <param name="blobNames">List of blob names</param> /// <param name="storageAccount">Storage Account to be used</param> /// <param name="containerName">Container that has the blobs</param> /// <param name="xValues">List of keys</param> /// <param name="yValues">List of values</param> public static void GetValuesFromBlobs(string[] blobNames, CloudStorageAccount storageAccount, string containerName, out List <string> xValues, out List <Object> yValues) { xValues = new List <string>(); yValues = new List <Object>(); Dictionary <string, object> combinedValues = new Dictionary <string, object>(); foreach (string blobName in blobNames) { string json = ReportHelpers.Load(storageAccount, blobName, containerName); if (json == null) { return; } JArray array = JArray.Parse(json); foreach (JObject item in array) { string currentKey = item["key"].ToString(); object currentValue = item["value"]; if (!combinedValues.ContainsKey(currentKey)) { combinedValues.Add(currentKey, currentValue); } else { combinedValues[currentKey] = Convert.ToInt64(currentValue) + Convert.ToInt64(combinedValues[currentKey]); } } } foreach (var item in combinedValues) { xValues.Add(item.Key); yValues.Add(item.Value); } }