Exemple #1
0
        public static SQLPerfOverview Get(string farmLabel, long startMillisFromEpoch, long endMillisFromEpoch)
        {
            SQLPerfOverview overview = new SQLPerfOverview();

            // SQL Processor Utilization Payload
            FarmPayload requestPayload = new FarmPayload()
            {
                Instance = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                DataCenter = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                Environment = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                FarmId = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                FarmLabel = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[1] {
                        farmLabel
                    }
                },
                FarmType = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[1] {
                        "Primary"
                    }
                },
                Machine = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                Network = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                Role = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[1] {
                        "SQL"
                    }
                },
            };
            // SQL Processor Utilization URL
            string sqlProcUtilURL = BuildURL("PerfCounters", "%255CProcessor(*)%255C%2525%2520Processor%2520Time", "Max", startMillisFromEpoch, endMillisFromEpoch, 40, "Automatic", false);

            // Make Post
            JarvisResponse response = JarvisRequester.PostRequest(sqlProcUtilURL, requestPayload);

            startMillisFromEpoch = response.StartTimeUtc;
            endMillisFromEpoch   = response.EndTimeUtc;
            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions   = eval.DimensionList.Values;
                string           machine      = dimensions.Where(dim => dim.Key.Equals(Dimension.MACHINE)).Single().Value;
                SeriesValues     seriesValues = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetProcessorUtilization(machine, seriesValues);
            }

            // SQL Thread Utilization Payload
            requestPayload.Instance.Item2 = new string[1] {
                "sqlservr"
            };

            // SQL Thread Utilization URL
            string sqlThreadUtilURL = BuildURL("PerfCounters", "%255CProcess(*)%255CThread%2520Count", "NullableAverage", startMillisFromEpoch, endMillisFromEpoch, 40, "Automatic", false);

            // Make Post
            response = JarvisRequester.PostRequest(sqlThreadUtilURL, requestPayload);
            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions   = eval.DimensionList.Values;
                string           machine      = dimensions.Where(dim => dim.Key.Equals(Dimension.MACHINE)).Single().Value;
                SeriesValues     seriesValues = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetThreadUtilization(machine, seriesValues);
            }

            // Slowest SQL Connection Time Payload
            requestPayload.Instance        = null;
            requestPayload.Machine         = null;
            requestPayload.Role.Item2[0]   = "USR";
            requestPayload.ContentDatabase = new PayloadItem()
            {
                Item1 = true, Item2 = new string[1] {
                    "<null>"
                }
            };
            requestPayload.IsContentAppPool = new PayloadItem()
            {
                Item1 = false, Item2 = new string[1] {
                    "true"
                }
            };

            // Slowest SQL Connection Time URL
            string slowestSQLConnectionTimeURL = BuildURL("RequestUsage", "TotalSqlConnectionDuration", "Sum", startMillisFromEpoch, endMillisFromEpoch, 40, "None", true);

            // Make Post
            response = JarvisRequester.PostRequest(slowestSQLConnectionTimeURL, requestPayload);
            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions   = eval.DimensionList.Values;
                string           database     = dimensions.Where(dim => dim.Key.Equals(Dimension.CONTENT_DATABASE)).Single().Value;
                SeriesValues     seriesValues = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetSlowestSQLConnectionTime(database, seriesValues);
            }

            // Slowest SQL Server Query Durations Payload
            requestPayload.Role               = null;
            requestPayload.ContentDatabase    = null;
            requestPayload.IsContentAppPool   = null;
            requestPayload.SlowestQueryServer = new PayloadItem()
            {
                Item1 = false, Item2 = new string[0]
            };

            // Slowest SQL Server Query Durations URL
            string slowestSQLQueryURL = BuildURL("RequestUsage", "TotalSlowQueryDuration", "Sum", startMillisFromEpoch, endMillisFromEpoch, 40, "None", true);

            // Make Post
            response = JarvisRequester.PostRequest(slowestSQLQueryURL, requestPayload);
            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions   = eval.DimensionList.Values;
                string           server       = dimensions.Where(dim => dim.Key.Equals(Dimension.SLOWEST_QUERY_SERVER)).Single().Value;
                SeriesValues     seriesValues = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetSlowestSQLDuration(server, seriesValues);
            }

            // Slowest SQL DB Query Durations Payload
            requestPayload.SlowestQueryDB = new PayloadItem()
            {
                Item1 = false, Item2 = new string[0]
            };

            // Slowest SQL Server Query Durations URL
            string slowestDBQueryURL = BuildURL("RequestUsage", "TotalSlowQueryDuration", "Sum", startMillisFromEpoch, endMillisFromEpoch, 200, "None", true);

            // Make Post
            response = JarvisRequester.PostRequest(slowestDBQueryURL, requestPayload);
            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions   = eval.DimensionList.Values;
                string           server       = dimensions.Where(dim => dim.Key.Equals(Dimension.SLOWEST_QUERY_DATABASE)).Single().Value;
                string           database     = dimensions.Where(dim => dim.Key.Equals(Dimension.SLOWEST_QUERY_SERVER)).Single().Value;
                SeriesValues     seriesValues = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetSlowestDBDuration(database, server, seriesValues);
            }

            return(overview);
        }
Exemple #2
0
        public static USRandRPSPerfOverview Get(string farmLabel, long startMillisFromEpoch, long endMillisFromEpoch)
        {
            USRandRPSPerfOverview overview = new USRandRPSPerfOverview();

            // USR Processor - % Processor Time for CPU
            FarmPayload requestPayload = new FarmPayload()
            {
                Instance = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[1] {
                        "_Total"
                    }
                },
                DataCenter = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                Environment = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                FarmId = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                FarmLabel = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[1] {
                        farmLabel
                    }
                },
                FarmType = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[1] {
                        "Primary"
                    }
                },
                Machine = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                Network = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                Role = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[1] {
                        "USR"
                    }
                },
            };
            // USR Processor - % Processor Time for CPU URL
            string processorCPUTimeURL = BuildURL("%255CProcessor(*)%255C%2525%2520Processor%2520Time", "NullableAverage", startMillisFromEpoch, endMillisFromEpoch);

            // Make Post
            JarvisResponse response = JarvisRequester.PostRequest(processorCPUTimeURL, requestPayload);

            startMillisFromEpoch = response.StartTimeUtc; // The jarvis site does some alignment w/ data (like gettin rid of milliseconds, etc.)
            endMillisFromEpoch   = response.EndTimeUtc;
            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions   = eval.DimensionList.Values;
                string           machine      = dimensions.Where(dim => dim.Key.Equals(Dimension.MACHINE)).Single().Value;
                SeriesValues     seriesValues = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetProcessorTimeCPU(machine, seriesValues);
            }

            // USR Processor - % Processor Time for Requests
            requestPayload.Instance.Item2 = new string[0];

            // USR Processor - % Processor Time for Requests
            string processorTimeRequestsURL = BuildURL("%255CASP%252ENET%255CRequests%2520Current", "Max", startMillisFromEpoch, endMillisFromEpoch);

            // Make Post
            response             = JarvisRequester.PostRequest(processorTimeRequestsURL, requestPayload);
            startMillisFromEpoch = response.StartTimeUtc; // The jarvis site does some alignment w/ data (like gettin rid of milliseconds, etc.)
            endMillisFromEpoch   = response.EndTimeUtc;
            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions   = eval.DimensionList.Values;
                string           machine      = dimensions.Where(dim => dim.Key.Equals(Dimension.MACHINE)).Single().Value;
                SeriesValues     seriesValues = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetProcessorTimeRequests(machine, seriesValues);
            }

            return(overview);
        }
Exemple #3
0
        public static ProbeOverview Get(string farmLabel, long startMillisFromEpoch, long endMillisFromEpoch)
        {
            ProbeOverview overview = new ProbeOverview();

            // Availability Payload
            FarmPayload requestPayload = new FarmPayload
            {
                InstanceNum = new PayloadItem {
                    Item1 = false, Item2 = new string[0]
                },
                RunnerName = new PayloadItem {
                    Item1 = false, Item2 = new string[] { "homepage", "uploaddoc", "teamsitehomepage" }
                },
                FarmLabel = new PayloadItem {
                    Item1 = false, Item2 = new string[1] {
                        farmLabel
                    }
                },
                FarmType = new PayloadItem {
                    Item1 = false, Item2 = new string[1] {
                        "Primary"
                    }
                }
            };
            // Availability URL
            string availabilityURL = BuildURL("Availability", "Success%20Rate", startMillisFromEpoch, endMillisFromEpoch);

            // Availability
            JarvisResponse response = JarvisRequester.PostRequest(availabilityURL, requestPayload);

            startMillisFromEpoch = response.StartTimeUtc;
            endMillisFromEpoch   = response.EndTimeUtc;

            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions = eval.DimensionList.Values;
                string           runnerName = dimensions.Where(dim => dim.Key.Equals(Dimension.RUNNER_NAME)).Single().Value;
                int          instanceNum    = Convert.ToInt32(dimensions.Where(dim => dim.Key.Equals(Dimension.INSTANCE_NUM)).Single().Value);
                SeriesValues seriesValues   = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetPageAvailability(seriesValues, runnerName, instanceNum);
            }

            requestPayload.InstanceNum = null;
            requestPayload.Environment = new PayloadItem()
            {
                Item1 = false,
                Item2 = new string[0]
            };
            requestPayload.Machine = new PayloadItem
            {
                Item1 = false,
                Item2 = new string[0]
            };

            // Availability By Machine
            response = JarvisRequester.PostRequest(availabilityURL, requestPayload);
            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions   = eval.DimensionList.Values;
                string           runnerName   = dimensions.Where(dim => dim.Key.Equals(Dimension.RUNNER_NAME)).Single().Value;
                string           machine      = dimensions.Where(dim => dim.Key.Equals(Dimension.MACHINE)).Single().Value;
                SeriesValues     seriesValues = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetMachineAvailability(seriesValues, runnerName, machine);
            }

            // Latency Payload
            requestPayload.Environment = null;
            requestPayload.Machine     = null;
            // Latency URL
            string latencyURL = BuildURL("Latency", "Average", startMillisFromEpoch, endMillisFromEpoch);

            // Latency
            response = JarvisRequester.PostRequest(availabilityURL, requestPayload);

            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions = eval.DimensionList.Values;
                string           runnerName = dimensions.Where(dim => dim.Key.Equals(Dimension.RUNNER_NAME)).Single().Value;

                SeriesValues seriesValues = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetPageLatency(seriesValues, runnerName);
            }

            return(overview);
        }