Ejemplo n.º 1
0
        public List <String> GetLoadTestResultFolderListFromEmailText(string emailTextFile)
        {
            List <String> loadTestResultFolderList = new List <string>();

            string[] lines = System.IO.File.ReadAllLines(emailTextFile);
            logger.WriteLine("LoadTestFolderLocator : Found load test result folder list : ");
            foreach (string line in lines)
            {
                int index = line.IndexOf(logFolderIndentifier);
                if (index >= 0)
                {
                    string testFolderPath = line.Substring(index + logFolderIndentifier.Length + 1);
                    testFolderPath = '\\' + testFolderPath;
                    loadTestResultFolderList.Add(@testFolderPath);
                    logger.WriteLine(testFolderPath);
                }
            }

            return(loadTestResultFolderList);
        }
        public void UploadStatisticsToAzureTable(string testFolderPath, string testType)
        {
            var siloStatisticTable = tableClient.GetTableReference(testType + "SiloStatistics");

            siloStatisticTable.CreateIfNotExists();
            var clientStatisticTable = tableClient.GetTableReference(testType + "ClientStatistics");

            clientStatisticTable.CreateIfNotExists();
            var tpsMetricTable = tableClient.GetTableReference(testType + "TestResultMetrics");

            tpsMetricTable.CreateIfNotExists();
            var siloAppRequestLatencyHisogramTable = tableClient.GetTableReference(testType + "AppRequestLatencyHisogramTableForSilo");

            siloAppRequestLatencyHisogramTable.CreateIfNotExists();
            var clientAppRequestLatencyHisogramTable = tableClient.GetTableReference(testType + "AppRequestLatencyHisogramTableForClient");

            clientAppRequestLatencyHisogramTable.CreateIfNotExists();
            var tpsMetricsFromTestAppLogsTable = tableClient.GetTableReference(testType + "TPSRelatedMetrics");

            tpsMetricsFromTestAppLogsTable.CreateIfNotExists();
            bool alreadyParsedTPS = false;

            foreach (var filePath in System.IO.Directory.EnumerateFiles(testFolderPath))
            {
                string fileName = filePath.Substring(filePath.LastIndexOf("\\") + 1);
                string deploymentId;
                if (fileName.StartsWith(siloLogStartWith))
                {
                    logger.WriteLine("Start to upload silo statistics from file" + filePath);
                    deploymentId = UploadLogStatistic(filePath, siloStatisticTable, siloAppRequestLatencyHisogramTable, true);
                    logger.WriteLine(String.Format("DeploymentId for {0} is {1}", filePath, deploymentId));
                    if (!alreadyParsedTPS)
                    {
                        alreadyParsedTPS = true;
                        foreach (var filePath2 in System.IO.Directory.EnumerateFiles(testFolderPath))
                        {
                            string fileName2 = filePath2.Substring(filePath.LastIndexOf("\\") + 1);
                            if (fileName2.StartsWith(tpsMetricFileStartWith))
                            {
                                logger.WriteLine("Start to upload load test results(TPS metrics) from file" + filePath);
                                UploadTPSMetrics(filePath2, deploymentId, tpsMetricTable);
                            }
                        }
                    }
                }
                else if (fileName.StartsWith(clientLogStartWith))
                {
                    logger.WriteLine("Start to upload client statistics from file" + filePath);
                    UploadLogStatistic(filePath, clientStatisticTable, clientAppRequestLatencyHisogramTable, false);
                }
                else if (fileName.StartsWith(testAppLogFileStartWith))
                {
                    logger.WriteLine("Start to upload tps related metrics from file" + filePath);
                    UploadTPSFromLogFiles(filePath, tpsMetricsFromTestAppLogsTable);
                }
            }

            logger.WriteLine("LogToStatisticsUploader : failed uploading records count : " + failedRecords);
        }