public MessageBrokerSegmentData(string vendor, string destination, MetricNames.MessageBrokerDestinationType destinationType, MetricNames.MessageBrokerAction action)
 {
     Vendor          = vendor;
     Destination     = destination;
     DestinationType = destinationType;
     Action          = action;
 }
        public void TransformSegment_TwoTransformCallsSame()
        {
            const string vendor      = "vendor1";
            const string destination = "queueA";
            const MetricNames.MessageBrokerDestinationType destinationType = MetricNames.MessageBrokerDestinationType.Queue;
            const MetricNames.MessageBrokerAction          action          = MetricNames.MessageBrokerAction.Consume;
            var segment = GetSegment(vendor, destinationType, destination, action);
            TransactionMetricName            txName  = new TransactionMetricName("WebTransaction", "Test", false);
            TransactionMetricStatsCollection txStats = new TransactionMetricStatsCollection(txName);

            segment.AddMetricStats(txStats, _configurationService);

            segment.AddMetricStats(txStats, _configurationService);

            var scoped   = txStats.GetScopedForTesting();
            var unscoped = txStats.GetUnscopedForTesting();

            Assert.AreEqual(1, scoped.Count);
            Assert.AreEqual(1, unscoped.Count);
            const string metricName = "MessageBroker/vendor1/Queue/Consume/Named/queueA";


            Assert.IsTrue(scoped.ContainsKey(metricName));
            Assert.IsTrue(unscoped.ContainsKey(metricName));

            var nameScoped   = scoped[metricName];
            var nameUnscoped = unscoped[metricName];

            Assert.AreEqual(2, nameScoped.Value0);
            Assert.AreEqual(2, nameUnscoped.Value0);
        }
        public void GetTransactionTraceName_ReturnsCorrectName(string queueName, MetricNames.MessageBrokerAction action, string expectedResult)
        {
            const string vendor = "MSMQ";
            const MetricNames.MessageBrokerDestinationType destinationType = MetricNames.MessageBrokerDestinationType.Queue;
            var segment = GetSegment(vendor, destinationType, queueName, action);
            var transactionTraceName = segment.GetTransactionTraceName();

            Assert.AreEqual(expectedResult, transactionTraceName);
        }
        public void TransformSegment_NullStats()
        {
            const string vendor      = "vendor1";
            const string destination = "queueA";
            const MetricNames.MessageBrokerDestinationType destinationType = MetricNames.MessageBrokerDestinationType.Queue;
            const MetricNames.MessageBrokerAction          action          = MetricNames.MessageBrokerAction.Consume;
            var segment = GetSegment(vendor, destinationType, destination, action);

            //make sure it does not throw
            segment.AddMetricStats(null, _configurationService);
        }
        public void TransformSegment_NullTransactionStats()
        {
            const string vendor      = "vendor1";
            const string destination = "queueA";
            const MetricNames.MessageBrokerDestinationType destinationType = MetricNames.MessageBrokerDestinationType.Queue;
            const MetricNames.MessageBrokerAction          action          = MetricNames.MessageBrokerAction.Consume;
            var segment = GetSegment(vendor, destinationType, destination, action);
            TransactionMetricName            txName  = new TransactionMetricName("WebTransaction", "Test", false);
            TransactionMetricStatsCollection txStats = new TransactionMetricStatsCollection(txName);

            segment.AddMetricStats(txStats, _configurationService);
        }
        private static Segment GetSegment(string vendor, MetricNames.MessageBrokerDestinationType destinationType, string destination, MetricNames.MessageBrokerAction action, double duration)
        {
            var methodCallData = new MethodCallData("foo", "bar", 1);
            var parameters     = (new Dictionary <string, object>());

            return(MessageBrokerSegmentDataTests.createMessageBrokerSegmentBuilder(new TimeSpan(), TimeSpan.FromSeconds(duration), 2, 1, methodCallData, parameters, vendor, destination, destinationType, action, false));
        }
        private static Segment GetSegment(string vendor, MetricNames.MessageBrokerDestinationType destinationType, string destination, MetricNames.MessageBrokerAction action)
        {
            var builder = new Segment(TransactionSegmentStateHelpers.GetItransactionSegmentState(), new MethodCallData("foo", "bar", 1));

            builder.SetSegmentData(new MessageBrokerSegmentData(vendor, destination, destinationType, action));
            builder.End();

            return(builder);
        }
Ejemplo n.º 8
0
        public static Segment createMessageBrokerSegmentBuilder(TimeSpan start, TimeSpan duration, int uniqueId, int?parentId, MethodCallData methodCallData, IEnumerable <KeyValuePair <string, object> > enumerable, string vendor, string queue, MetricNames.MessageBrokerDestinationType type, MetricNames.MessageBrokerAction action, bool combinable)
        {
            var segment = new Segment(SimpleSegmentDataTests.createTransactionSegmentState(uniqueId, parentId), methodCallData);

            segment.SetSegmentData(new MessageBrokerSegmentData(vendor, queue, type, action));
            segment.Combinable = combinable;

            return(new Segment(start, duration, segment, null));
        }