当前位置: 首页>>代码示例>>C#>>正文


C# Statsd.Add方法代码示例

本文整理汇总了C#中StatsdClient.Statsd.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Statsd.Add方法的具体用法?C# Statsd.Add怎么用?C# Statsd.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StatsdClient.Statsd的用法示例。


在下文中一共展示了Statsd.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: add_one_counter_and_one_gauge_sends_and_removes_commands

        public void add_one_counter_and_one_gauge_sends_and_removes_commands()
        {
            Statsd s = new Statsd(udp, _randomGenerator, _stopwatch);
            s.Add("counter", 1, 0.1);
            s.Add<Statsd.Timing>("timer", 1);
            s.Send();

            Assert.That(s.Commands.Count,Is.EqualTo(0));
        }
开发者ID:raoulmillais,项目名称:statsd-csharp-client,代码行数:9,代码来源:StatsdUnitTests.cs

示例2: add_one_counter_and_one_gauge_sends_in_one_go

        public void add_one_counter_and_one_gauge_sends_in_one_go()
        {
            Statsd s = new Statsd(udp, _randomGenerator, _stopwatch);
            s.Add("counter", 1, 0.1);
            s.Add<Statsd.Timing>("timer", 1);
            s.Send();

            udp.AssertWasCalled(x => x.Send("counter:1|c|@0.1" + Environment.NewLine + "timer:1|ms" + Environment.NewLine));
        }
开发者ID:raoulmillais,项目名称:statsd-csharp-client,代码行数:9,代码来源:StatsdUnitTests.cs

示例3: add_counter_sets_prefix_on_name

        public void add_counter_sets_prefix_on_name()
        {
            Statsd s = new Statsd(udp, _randomGenerator, _stopwatch, "another.prefix.");

            s.Add<Statsd.Counting,int>("counter", 1, sampleRate: 0.1);
            s.Add<Statsd.Timing,int>("timer", 1);
            s.Send();

            udp.AssertWasCalled(x => x.Send("another.prefix.counter:1|c|@0.1\nanother.prefix.timer:1|ms"));
        }
开发者ID:kjgorman,项目名称:dogstatsd-csharp-client,代码行数:10,代码来源:StatsdUnitTests.cs

示例4: add_counter_sets_prefix_on_name

        public void add_counter_sets_prefix_on_name()
        {
            Statsd s = new Statsd(udp, _randomGenerator, _stopwatch, "another.prefix.");

            s.Add("counter", 1, 0.1);
            s.Add<Statsd.Timing>("timer", 1);
            s.Send();

            udp.AssertWasCalled(x => x.Send("another.prefix.counter:1|c|@0.1" + Environment.NewLine + "another.prefix.timer:1|ms"));
        }
开发者ID:AnthonySteele,项目名称:statsd-csharp-client,代码行数:10,代码来源:StatsdUnitTests.cs

示例5: add_one_counter_and_one_gauge_shows_in_commands

            public void add_one_counter_and_one_gauge_shows_in_commands()
            {
                var s = new Statsd(_udp, _randomGenerator, _stopwatch);
                s.Add<Statsd.Counting>("counter", 1, 0.1);
                s.Add<Statsd.Timing>("timer", 1);

                Assert.That(s.Commands.Count, Is.EqualTo(2));
                Assert.That(s.Commands[0], Is.EqualTo("counter:1|c|@0.1"));
                Assert.That(s.Commands[1], Is.EqualTo("timer:1|ms"));
            }
开发者ID:FrancisVarga,项目名称:statsd-csharp-client,代码行数:10,代码来源:StatsdTests.cs

示例6: add_one_counter_and_one_gauge_with_no_sample_rate_shows_in_commands

        public void add_one_counter_and_one_gauge_with_no_sample_rate_shows_in_commands()
        {
            Statsd s = new Statsd(udp, _randomGenerator, _stopwatch);
            s.Add<Statsd.Counting>("counter", 1);
            s.Add<Statsd.Timing>("timer", 1);

            Assert.That(s.Commands.Count, Is.EqualTo(2));
            Assert.That(s.Commands[0], Is.EqualTo("counter:1|c"));
            Assert.That(s.Commands[1], Is.EqualTo("timer:1|ms"));
        }
开发者ID:raoulmillais,项目名称:statsd-csharp-client,代码行数:10,代码来源:StatsdUnitTests.cs

示例7: add_gauge_double

        public void add_gauge_double()
        {
            Statsd s = new Statsd(udp, _randomGenerator, _stopwatch);
            s.Add<Statsd.Gauge,double>("gauge", 5.3);

            Assert.That(s.Commands.Count, Is.EqualTo(1));
            Assert.That(s.Commands[0], Is.EqualTo("gauge:5.3|g"));
        }
开发者ID:kjgorman,项目名称:dogstatsd-csharp-client,代码行数:8,代码来源:StatsdUnitTests.cs

示例8: add_gauge_with_sample_rate

        public void add_gauge_with_sample_rate()
        {
            Statsd s = new Statsd(udp, _randomGenerator, _stopwatch);
            s.Add<Statsd.Gauge,int>("gauge", 5, sampleRate: 0.5);

            Assert.That(s.Commands.Count, Is.EqualTo(1));
            Assert.That(s.Commands[0], Is.EqualTo("gauge:5|g|@0.5"));
        }
开发者ID:kjgorman,项目名称:dogstatsd-csharp-client,代码行数:8,代码来源:StatsdUnitTests.cs

示例9: add_gauge_with_sample_rate_and_tags_double

        public void add_gauge_with_sample_rate_and_tags_double()
        {
            Statsd s = new Statsd(udp, _randomGenerator, _stopwatch);
            s.Add<Statsd.Gauge,int>("gauge", 5, sampleRate: 0.5, tags: new[] {"tag1:true", "tag2"});

            Assert.That(s.Commands.Count, Is.EqualTo(1));
            Assert.That(s.Commands[0], Is.EqualTo("gauge:5|g|@0.5|#tag1:true,tag2"));
        }
开发者ID:kjgorman,项目名称:dogstatsd-csharp-client,代码行数:8,代码来源:StatsdUnitTests.cs

示例10: add_one_counter_and_one_timer_sends_in_one_go

            public void add_one_counter_and_one_timer_sends_in_one_go()
            {
                var s = new Statsd(_udp, _randomGenerator, _stopwatch);
                s.Add<Statsd.Counting>("counter", 1, 0.1);
                s.Add<Statsd.Timing>("timer", 1);
                s.Send();

                _udp.AssertWasCalled(x => x.Send("counter:1|c|@0.1\ntimer:1|ms"));
            }
开发者ID:FrancisVarga,项目名称:statsd-csharp-client,代码行数:9,代码来源:StatsdTests.cs

示例11: add_one_counter_and_send_one_gauge_sends_only_sends_the_last_and_clears_queue

        public void add_one_counter_and_send_one_gauge_sends_only_sends_the_last_and_clears_queue()
        {
            Statsd s = new Statsd(udp, _randomGenerator, _stopwatch);
            s.Add<Statsd.Counting,int>("counter", 1);
            s.Send<Statsd.Timing,int>("timer", 1);

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

            s.Send();

            udp.AssertWasNotCalled(x => x.Send("counter:1|c"));
        }
开发者ID:kjgorman,项目名称:dogstatsd-csharp-client,代码行数:12,代码来源:StatsdUnitTests.cs

示例12: add_timer_with_lamba_still_records_on_error_and_still_bubbles_up_exception

        public void add_timer_with_lamba_still_records_on_error_and_still_bubbles_up_exception()
        {
            const string statName = "name";

            var stopwatch = MockRepository.GenerateMock<IStopwatch>();
            stopwatch.Stub(x => x.ElapsedMilliseconds()).Return(500);
            _stopwatch.Stub(x => x.Get()).Return(stopwatch);

            var s = new Statsd(udp, _randomGenerator, _stopwatch);

            Assert.Throws<InvalidOperationException>(() => s.Add(() => { throw new InvalidOperationException(); }, statName));

            Assert.That(s.Commands.Count, Is.EqualTo(1));
            Assert.That(s.Commands[0], Is.EqualTo("name:500|ms"));
        }
开发者ID:AnthonySteele,项目名称:statsd-csharp-client,代码行数:15,代码来源:StatsdUnitTests.cs

示例13: add_one_counter_and_send_one_gauge_sends_only_sends_the_last_two_doubles

        public void add_one_counter_and_send_one_gauge_sends_only_sends_the_last_two_doubles()
        {
            Statsd s = new Statsd(udp, _randomGenerator, _stopwatch);
            s.Add<Statsd.Counting,double>("counter", 1.1);
            s.Send<Statsd.Timing,double>("timer", 1.1);

            udp.AssertWasCalled(x => x.Send("timer:1.1|ms"));
        }
开发者ID:kjgorman,项目名称:dogstatsd-csharp-client,代码行数:8,代码来源:StatsdUnitTests.cs

示例14: add_timer_with_lamba_and_sampleRate_passes

            public void add_timer_with_lamba_and_sampleRate_passes()
            {
                const string statName = "name";

                var stopwatch = MockRepository.GenerateMock<IStopwatch>();
                stopwatch.Stub(x => x.ElapsedMilliseconds()).Return(500);
                _stopwatch.Stub(x => x.Get()).Return(stopwatch);
                _randomGenerator = MockRepository.GenerateMock<IRandomGenerator>();
                _randomGenerator.Stub(x => x.ShouldSend(Arg<double>.Is.Anything)).Return(true);

                var s = new Statsd(_udp, _randomGenerator, _stopwatch);
                s.Add(() => TestMethod(), statName, 0.1);

                Assert.That(s.Commands.Count, Is.EqualTo(1));
                Assert.That(s.Commands[0], Is.EqualTo("name:500|ms"));
            }
开发者ID:FrancisVarga,项目名称:statsd-csharp-client,代码行数:16,代码来源:StatsdTests.cs

示例15: add_set_string

        public void add_set_string()
        {
            Statsd s = new Statsd(udp, _randomGenerator, _stopwatch);
            s.Add<Statsd.Set,string>("set", "string");

            Assert.That(s.Commands.Count, Is.EqualTo(1));
            Assert.That(s.Commands[0], Is.EqualTo("set:string|s"));
        }
开发者ID:kjgorman,项目名称:dogstatsd-csharp-client,代码行数:8,代码来源:StatsdUnitTests.cs


注:本文中的StatsdClient.Statsd.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。