예제 #1
0
        public string GetResolverLag()
        {
            string blobName;
            string date = String.Format("{0:yyyy-MM-dd}", DateTimeUtility.GetPacificTimeNow());

            blobName = "ResolverLag" + date + ".json";
            Dictionary <string, string> ResolverDict = BlobStorageService.GetDictFromBlob(blobName);
            List <TimeSpan>             timeStamps   = new List <TimeSpan>();

            if (ResolverDict != null && ResolverDict.Count > 0)
            {
                foreach (KeyValuePair <string, string> entry in ResolverDict)
                {
                    DateTime time = DateTime.Parse(string.Format("{0:HH:mm}", entry.Key));
                    timeStamps.Add(time.TimeOfDay);
                }

                string latest = timeStamps.Max().Hours + ":" + timeStamps.Max().Minutes;
                double value  = Double.Parse(ResolverDict[latest.ToString()]);
                long   lag    = Convert.ToInt64(value);
                return("Lag: " + lag);
            }

            else
            {
                return("Lag: N/A");
            }
        }
예제 #2
0
        public JsonResult GetSearchServiceStatus()
        {
            Dictionary <string, string> dict_cpu = BlobStorageService.GetDictFromBlob("SearchCpuUsage" + string.Format("{0:MMdd}", DateTime.Now) + "HourlyReport.json");
            Dictionary <string, string> dict_mem = BlobStorageService.GetDictFromBlob("SearchMemUsage" + string.Format("{0:MMdd}", DateTime.Now) + "HourlyReport.json");
            StringBuilder sb = new StringBuilder();

            sb.Append("<h1>" + "CPU Seconds" + "</h1> </br>");
            if (dict_cpu != null && dict_cpu.Count > 0)
            {
                sb.Append(dict_cpu.Values.Last() + "</br>");
            }
            else
            {
                sb.Append("N/A");
            }

            sb.Append("<h1>" + "virual memory size" + "</h1> </br>");
            if (dict_mem != null && dict_mem.Count > 0)
            {
                sb.Append(dict_mem.Values.Last() + "</br>");
            }
            else
            {
                sb.Append("N/A");
            }

            return(Json(sb.ToString(), JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        /// <summary>
        /// Returns the active requests taken during the last snapshot
        /// </summary>
        /// <param name="hour"></param>
        /// <returns></returns>
        public ActionResult DBRequestsSummary()
        {
            Dictionary <string, string> dict           = BlobStorageService.GetDictFromBlob("DBRequestDetails" + string.Format("{0:MMdd}", DateTimeUtility.GetPacificTimeNow()) + ".json");
            List <DatabaseRequest>      listOfRequests = new List <DatabaseRequest>();

            if (dict != null && dict.Count > 0)
            {
                listOfRequests = new JavaScriptSerializer().Deserialize <List <DatabaseRequest> >(dict.Values.ElementAt(dict.Count - 1));
            }
            return(PartialView("~/Views/Database/DBRequestsSummary.cshtml", listOfRequests));
        }
예제 #4
0
        public JsonResult GetCurrentIndexingStatus()
        {
            Dictionary <string, string> dict = BlobStorageService.GetDictFromBlob("IndexingDiffCount" + string.Format("{0:MMdd}", DateTimeUtility.GetPacificTimeNow()) + "HourlyReport.json");

            if (dict != null && dict.Count > 0)
            {
                return(Json(dict.Values.ElementAt(dict.Count - 1), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("N/A"));
            }
        }
예제 #5
0
        public JsonResult TrafficManager_GetEndPointStatus(int endpoint)
        {
            Dictionary <string, string> dict = BlobStorageService.GetDictFromBlob("TrafficManagerStatus.json");

            if (dict != null && dict.Count > 0)
            {
                return(Json("<h1>" + dict.Keys.ElementAt(endpoint) + "</h1> </br> </br>" + dict.Values.ElementAt(endpoint), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("N/A"));
            }
        }
예제 #6
0
        private List <Tuple <string, long, long, long> > GetLatencyData(string date)
        {
            Dictionary <string, string> uploadDict          = BlobStorageService.GetDictFromBlob("UploadPackageTimeElapsed" + date + ".json");
            Dictionary <string, string> searchDict          = BlobStorageService.GetDictFromBlob("SearchPackageTimeElapsed" + date + ".json");
            Dictionary <string, string> downloadDict        = BlobStorageService.GetDictFromBlob("DownloadPackageTimeElapsed" + date + ".json");
            List <Tuple <string, long, long, long> > result = new List <Tuple <string, long, long, long> >();

            if (uploadDict != null)
            {
                List <double> latency = new List <double>();
                foreach (KeyValuePair <string, string> keyValuePair in uploadDict)
                {
                    latency.Add(Convert.ToDouble(keyValuePair.Value));
                }

                long average = Convert.ToInt64(latency.Average());
                long highest = Convert.ToInt64(latency.Max());
                long lowest  = Convert.ToInt64(latency.Min());
                result.Add(new Tuple <string, long, long, long>("Upload", average, highest, lowest));
            }

            if (searchDict != null)
            {
                List <double> latency = new List <double>();
                foreach (KeyValuePair <string, string> keyValuePair in searchDict)
                {
                    latency.Add(Convert.ToDouble(keyValuePair.Value));
                }

                long average = Convert.ToInt64(latency.Average());
                long highest = Convert.ToInt64(latency.Max());
                long lowest  = Convert.ToInt64(latency.Min());
                result.Add(new Tuple <string, long, long, long>("Search", average, highest, lowest));
            }

            if (downloadDict != null)
            {
                List <double> latency = new List <double>();
                foreach (KeyValuePair <string, string> keyValuePair in downloadDict)
                {
                    latency.Add(Convert.ToDouble(keyValuePair.Value));
                }

                long average = Convert.ToInt64(latency.Average());
                long highest = Convert.ToInt64(latency.Max());
                long lowest  = Convert.ToInt64(latency.Min());
                result.Add(new Tuple <string, long, long, long>("Download", average, highest, lowest));
            }

            return(result);
        }
예제 #7
0
        public JsonResult GetHourlyInstanceCount()
        {
            //TBD: Need to take the service name from the config.
            Dictionary <string, string> dict = BlobStorageService.GetDictFromBlob("nuget-prod-0-v2galleryInstanceCount" + string.Format("{0:MMdd}", DateTimeUtility.GetPacificTimeNow()) + "HourlyReport.json");

            if (dict != null && dict.Count > 0)
            {
                return(Json(dict.Values.ElementAt(dict.Count - 1), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("N/A"));
            }
        }
예제 #8
0
        public ActionResult AverageTimeTakenInMsTrendToday()
        {
            List <DotNet.Highcharts.Options.Series> seriesSet = new List <DotNet.Highcharts.Options.Series>();
            List <string> value = new List <string>();
            Dictionary <string, string> dict = BlobStorageService.GetDictFromBlob("IISRequestDetails" + String.Format("{0:MMdd}", DateTime.Now.AddDays(-1)) + ".json");

            if (dict != null)
            {
                List <IISRequestDetails>            requestDetails = new List <IISRequestDetails>();
                Dictionary <string, List <object> > request        = new Dictionary <string, List <object> >();
                foreach (KeyValuePair <string, string> keyValuePair in dict)
                {
                    value.Add(keyValuePair.Key.Substring(0, 2));
                    requestDetails = new JavaScriptSerializer().Deserialize <List <IISRequestDetails> >(keyValuePair.Value);

                    foreach (IISRequestDetails scenarios in requestDetails)
                    {
                        if (scenarios.ScenarioName.Equals("Over all requests"))
                        {
                            continue;
                        }
                        if (request.ContainsKey(scenarios.ScenarioName))
                        {
                            request[scenarios.ScenarioName].Add(scenarios.AvgTimeTakenInMilliSeconds);
                        }
                        else
                        {
                            List <object> Yvalue = new List <object>();
                            Yvalue.Add(scenarios.AvgTimeTakenInMilliSeconds);
                            request.Add(scenarios.ScenarioName, Yvalue);
                        }
                    }
                }

                foreach (KeyValuePair <string, List <object> > each in request)
                {
                    seriesSet.Add(new DotNet.Highcharts.Options.Series
                    {
                        Data = new Data(each.Value.ToArray()),
                        Name = each.Key.Replace(" ", "_")
                    });
                }
            }
            DotNet.Highcharts.Highcharts chart = ChartingUtilities.GetLineChart(seriesSet, value, "TodayAvgTimeInMsTrend", 500);
            return(PartialView("~/Views/Shared/PartialChart.cshtml", chart));
        }
예제 #9
0
        public JsonResult GetCloudServiceInstanceStatus(string CloudServiceName)
        {
            Dictionary <string, string> dict = BlobStorageService.GetDictFromBlob(CloudServiceName + "InstanceStatus.json");

            if (dict != null && dict.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("<h1>" + CloudServiceName + "</h1> </br>");
                foreach (KeyValuePair <string, string> kvp in dict)
                {
                    sb.Append(kvp.Key + "-" + kvp.Value + "</br>");
                }
                return(Json(sb.ToString(), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("N/A", JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult GetHourlyUsertatus()
        {
            Dictionary <string, string> dict = BlobStorageService.GetDictFromBlob("Users" + string.Format("{0:MMdd}", DateTimeUtility.GetPacificTimeNow()) + "HourlyReport.json");

            if (dict != null && dict.Count > 0)
            {
                //find the sum of values of each hour from today's report.
                int sum = 0;
                foreach (KeyValuePair <string, string> pair in dict)
                {
                    int count = Convert.ToInt32(pair.Value);
                    sum = sum + count;
                }
                return(Json(sum.ToString(), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("N/A"));
            }
        }
예제 #11
0
        private List <Tuple <string, string, string, double> > GetRequestsData(string date)
        {
            Dictionary <string, string> dict           = BlobStorageService.GetDictFromBlob("IISRequestDetails" + date + ".json");
            List <IISRequestDetails>    requestDetails = new List <IISRequestDetails>();
            List <Tuple <string, string, string, double> > scenarios = new List <Tuple <string, string, string, double> >();

            if (dict != null)
            {
                foreach (KeyValuePair <string, string> keyValuePair in dict)
                {
                    requestDetails.AddRange(new JavaScriptSerializer().Deserialize <List <IISRequestDetails> >(keyValuePair.Value));
                }

                var requestGroups = requestDetails.GroupBy(item => item.ScenarioName);

                foreach (IGrouping <string, IISRequestDetails> group in requestGroups)
                {
                    scenarios.Add(new Tuple <string, string, string, double>(group.Key, Convert.ToInt32(group.Average(item => item.RequestsPerHour)).ToString(), Convert.ToInt32(group.Max(item => item.RequestsPerHour)).ToString(), Convert.ToInt32(group.Average(item => item.AvgTimeTakenInMilliSeconds))));
                }
            }

            return(scenarios);
        }
        public ActionResult VsDownloadTrend()
        {
            Dictionary <string, string> content = BlobStorageService.GetDictFromBlob("VsTrend" + "30Day.json");

            return(PartialView("~/Views/Trending/VsDownloadTrend.cshtml", content));
        }