public static void TransactionTraceExists(AgentLogFile agentLogFile, string transactionName)
        {
            var trace = agentLogFile.GetTransactionSamples()
                        .Where(sample => sample != null)
                        .Where(sample => sample.Path == transactionName)
                        .FirstOrDefault();

            var failureMessage = string.Format("Transaction trace does not exist (but should).  Transaction Name: {0}", transactionName);

            Assert.True(trace != null, failureMessage);
        }
예제 #2
0
        public static List <Metric> GetMetrics(AgentLogFile agentLogFile, TimeSpan?timeoutOrZero = null)
        {
            var metrics   = new List <Metric>();
            var timeout   = timeoutOrZero ?? TimeSpan.FromSeconds(5);
            var timeTaken = Stopwatch.StartNew();

            do
            {
                metrics = agentLogFile.GetMetrics().ToList();
                if (metrics.Count > 0)
                {
                    return(metrics);
                }
                Thread.Sleep(TimeSpan.FromMilliseconds(100));
            } while (timeTaken.Elapsed < timeout);

            return(metrics);
        }