public void Setup()
 {
     _statsd = new Mock<IStatsd>();
     _statsd.Setup(x => x.LogCount(It.IsAny<string>(), It.IsAny<int>()));
     _statsd.Setup(x => x.LogTiming(It.IsAny<string>(), It.IsAny<long>()));
     _client = new VeStatsDClient(_statsd.Object, "foo");
 }
Beispiel #2
0
 public void Setup()
 {
     _statsd = new Mock <IStatsd>();
     _statsd.Setup(x => x.LogCount(It.IsAny <string>(), It.IsAny <int>()));
     _statsd.Setup(x => x.LogTiming(It.IsAny <string>(), It.IsAny <long>()));
     _client = new VeStatsDClient(_statsd.Object, "foo");
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            var statsdConfig = InstantiateStatsdConfig();
            var client       = new VeStatsDClient(statsdConfig);

            var publisherFactory = GetPublisher(client);
            var sender           = GetSender(publisherFactory);

            var consumer = GetConsumer();


            SendMultipleMessages(sender);
            Task.Run(() =>
            {
                while (true)
                {
                    var messages = consumer.RetrieveMessages <HouseDto>(int.MaxValue, 100);

                    foreach (var message in messages)
                    {
                        Console.WriteLine($"House: {message.Name} of {message.Owner}");
                    }
                }
            });
            Console.ReadLine();
        }
        public void It_should_include_custom_tags_before_sending_metrics()
        {
            var client = new VeStatsDClient(_statsd.Object, "foo", new Dictionary <string, string> {
                { "foo", "bar" }
            });

            client.LogCount("foo.bar");
            _statsd.Verify(x => x.LogCount(It.IsRegex("foo\\.bar\\,host\\=([A-Za-z0-9-]+)\\,datacenter\\=foo\\,foo\\=bar"), It.IsAny <int>()));
        }
Beispiel #5
0
 public void It_should_not_allow_appname_to_be_empty()
 {
     Should.Throw <ArgumentNullException>(() =>
     {
         var client =
             new VeStatsDClient(new StatsdConfig()
         {
             Datacenter = "bar"
         });
     });
 }
Beispiel #6
0
 public void It_should_not_allow_datacenter_to_be_empty()
 {
     Should.Throw <ArgumentNullException>(() =>
     {
         var client =
             new VeStatsDClient(new StatsdConfig()
         {
             AppName = "foo"
         });
     });
 }
 public void It_should_not_allow_datacenter_to_be_empty()
 {
     Should.Throw<ArgumentNullException>(() =>
     {
         var client =
             new VeStatsDClient(new StatsdConfig()
             {
                 AppName = "foo"
             });
     });
 }
 public void It_should_not_allow_appname_to_be_empty()
 {
     Should.Throw<ArgumentNullException>(() =>
     {
         var client =
             new VeStatsDClient(new StatsdConfig()
             {
                 Datacenter = "bar"
             });
     });
 }
Beispiel #9
0
        private static PublisherFactory GetPublisher(VeStatsDClient client)
        {
            var publisherFactory = new PublisherFactory(
                client,
                new FailoverResolver(),
                new SimpleSerializer(),
                new TopicClientCreator(new TopicCreator())
                );

            return(publisherFactory);
        }