Пример #1
0
            public void set_prefix_on_stats_name_when_calling_send()
            {
                var s = new Statsd(_udp, "a.prefix.");

                s.SendInteger(IntegralMetric.Counter, "counter", 5);
                s.SendInteger(IntegralMetric.Counter, "counter", 5);

                _udp.AssertWasCalled(x => x.Send("a.prefix.counter:5|c"), x => x.Repeat.Twice());
            }
Пример #2
0
            public void timing_with_value_of_X_and_sample_rate()
            {
                var s = new Statsd(_udp, SampleEverything);

                s.SendInteger(IntegralMetric.Timer, "timer", 5, 0.1);
                _udp.AssertWasCalled(x => x.Send("timer:5|ms|@0.1"));
            }
Пример #3
0
            public void adds_timing()
            {
                var s = new Statsd(_udp, SampleEverything);

                s.SendInteger(IntegralMetric.Timer, "timer", 5);
                _udp.AssertWasCalled(x => x.Send("timer:5|ms"));
            }
Пример #4
0
            public void increases_counter_with_value_of_X_and_sample_rate()
            {
                var s = new Statsd(_udp, SampleEverything);

                s.SendInteger(IntegralMetric.Counter, "counter", 5, 0.1);
                _udp.AssertWasCalled(x => x.Send("counter:5|c|@0.1"));
            }
Пример #5
0
            public void adds_histogram()
            {
                var s = new Statsd(_udp, SampleEverything);

                s.SendInteger(IntegralMetric.Histogram, "histogram", 5);
                _udp.AssertWasCalled(x => x.Send("histogram:5|h"));
            }
Пример #6
0
            public void adds_meter()
            {
                var s = new Statsd(_udp, SampleEverything);

                s.SendInteger(IntegralMetric.Meter, "meter", 5);
                _udp.AssertWasCalled(x => x.Send("meter:5|m"));
            }
Пример #7
0
            public void timing_exception_fails_silently()
            {
                _udp.Stub(x => x.Send(Arg <string> .Is.Anything)).Throw(new Exception());
                var s = new Statsd(_udp);

                s.SendInteger(IntegralMetric.Timer, "timer", 5);
                Assert.Pass();
            }
Пример #8
0
            public void counting_exception_fails_silently()
            {
                var s = new Statsd(_udp, SampleEverything);

                _udp.Stub(x => x.Send(Arg <string> .Is.Anything)).Throw(new Exception());
                s.SendInteger(IntegralMetric.Counter, "counter", 5);
                Assert.Pass();
            }
Пример #9
0
            public void histrogram_exception_fails_silently()
            {
                _udp.Stub(x => x.Send(Arg <string> .Is.Anything)).Throw(new Exception());
                var s = new Statsd(_udp);

                s.SendInteger(IntegralMetric.Histogram, "histogram", 5);
                Assert.Pass();
            }
Пример #10
0
            public void add_one_counter_and_send_one_timer_sends_only_sends_the_last()
            {
                var s = new Statsd(_udp, SampleEverything);

                s.AddInteger(IntegralMetric.Counter, "counter", 1);
                s.SendInteger(IntegralMetric.Timer, "timer", 1);

                _udp.AssertWasCalled(x => x.Send("timer:1|ms"));
            }