public void LogOneGauge_OneGraphiteLine_Success() { _block.Post(new Gauge("foo", 1)); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(); _block.CompleteAndWait(); Assert.AreEqual(1, _outputBuffer.Items.Count); Assert.AreEqual(1, _outputBuffer["foo"]); }
public void WriteLatenciesToTwoBuckets_MeasurementsSeparate_Success() { _block = TimedLatencyAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, _log.Object); var pulseDate = DateTime.Now; // Bucket one TestUtility.Range(5, false).ForEach(p => _block.Post(new Timing("foo", p * 100))); // Bucket two TestUtility.Range(5, false).ForEach(p => _block.Post(new Timing("bar", p * 100))); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(pulseDate); Assert.AreEqual(5, _outputBuffer["foo.count"]); Assert.AreEqual(100, _outputBuffer["foo.min"]); Assert.AreEqual(500, _outputBuffer["foo.max"]); Assert.AreEqual(300, _outputBuffer["foo.mean"]); Assert.AreEqual(1500, _outputBuffer["foo.sum"]); Assert.AreEqual(5, _outputBuffer["bar.count"]); Assert.AreEqual(100, _outputBuffer["bar.min"]); Assert.AreEqual(500, _outputBuffer["bar.max"]); Assert.AreEqual(300, _outputBuffer["bar.mean"]); Assert.AreEqual(1500, _outputBuffer["bar.sum"]); Assert.AreEqual(10, _outputBuffer.Items.Count); }
public void WriteOneLatency_OneMetricFlushed_Success() { _block = TimedLatencyAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, true, _log.Object); var pulseDate = DateTime.Now; _block.Post(new Timing("foo.bar.baz", 100)); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(pulseDate); Assert.AreEqual(new GraphiteLine("foo.bar.baz.count", 1, pulseDate.ToEpoch()),_outputBuffer.GetGraphiteLine(0)); Assert.AreEqual(new GraphiteLine("foo.bar.baz.min", 100, pulseDate.ToEpoch()), _outputBuffer.GetGraphiteLine(1)); Assert.AreEqual(new GraphiteLine("foo.bar.baz.max", 100, pulseDate.ToEpoch()), _outputBuffer.GetGraphiteLine(2)); Assert.AreEqual(new GraphiteLine("foo.bar.baz.mean", 100, pulseDate.ToEpoch()), _outputBuffer.GetGraphiteLine(3)); Assert.AreEqual(new GraphiteLine("foo.bar.baz.sum", 100, pulseDate.ToEpoch()), _outputBuffer.GetGraphiteLine(4)); Assert.AreEqual(new GraphiteLine("foo.bar.baz.sumSquares", 10000, pulseDate.ToEpoch()), _outputBuffer.GetGraphiteLine(5)); Assert.AreEqual(6, _outputBuffer.GraphiteLines.Count); // Ensure that min, max, mean and sum are all equal Assert.IsTrue(_outputBuffer.GetGraphiteLine(1).Quantity == _outputBuffer.GetGraphiteLine(2).Quantity && _outputBuffer.GetGraphiteLine(2).Quantity == _outputBuffer.GetGraphiteLine(3).Quantity && _outputBuffer.GetGraphiteLine(3).Quantity == _outputBuffer.GetGraphiteLine(4).Quantity); }
public void WriteOneLatency_OneMetricFlushed_Success() { _block = TimedLatencyAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, true, _log.Object); var pulseDate = DateTime.Now; _block.Post(new Timing("foo.bar.baz", 100)); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(pulseDate); Assert.AreEqual(new GraphiteLine("foo.bar.baz.count", 1, pulseDate.ToEpoch()), _outputBuffer.GetGraphiteLine(0)); Assert.AreEqual(new GraphiteLine("foo.bar.baz.min", 100, pulseDate.ToEpoch()), _outputBuffer.GetGraphiteLine(1)); Assert.AreEqual(new GraphiteLine("foo.bar.baz.max", 100, pulseDate.ToEpoch()), _outputBuffer.GetGraphiteLine(2)); Assert.AreEqual(new GraphiteLine("foo.bar.baz.mean", 100, pulseDate.ToEpoch()), _outputBuffer.GetGraphiteLine(3)); Assert.AreEqual(new GraphiteLine("foo.bar.baz.sum", 100, pulseDate.ToEpoch()), _outputBuffer.GetGraphiteLine(4)); Assert.AreEqual(new GraphiteLine("foo.bar.baz.sumSquares", 10000, pulseDate.ToEpoch()), _outputBuffer.GetGraphiteLine(5)); Assert.AreEqual(6, _outputBuffer.GraphiteLines.Count); // Ensure that min, max, mean and sum are all equal Assert.IsTrue(_outputBuffer.GetGraphiteLine(1).Quantity == _outputBuffer.GetGraphiteLine(2).Quantity && _outputBuffer.GetGraphiteLine(2).Quantity == _outputBuffer.GetGraphiteLine(3).Quantity && _outputBuffer.GetGraphiteLine(3).Quantity == _outputBuffer.GetGraphiteLine(4).Quantity); }
public void WriteOneHunderedLatencies_p50PercentileLogged_Success() { _block = TimedLatencyPercentileAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, 50, null); TestUtility.Range(100, false).ForEach(p => _block.Post(new Timing("foo", p))); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(); _outputBuffer["foo.p50"].ShouldBe(50); }
public void WriteOneHunderedLatencies_p90PercentileLogged_Success() { _block = TimedLatencyPercentileAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, 90, null, _log.Object); TestUtility.Range(100, false).ForEach(p => _block.Post(new Timing("foo", p))); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(); Assert.AreEqual(90, _outputBuffer["foo.p90"]); }
public void WriteOneHunderedLatencies_p90PercentileLogged_Success() { _block = TimedLatencyPercentileAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, 90, null, _log.Object); TestUtility.Range(100, false).ForEach(p => _block.Post(new Timing("foo", p))); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(); Assert.AreEqual(90, _outputBuffer["foo.p90"]); }
public void WriteFourLatencies_PercentileLogged_Success() { _block = TimedLatencyPercentileAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, 90, null); _block.Post(new Timing("foo", 100)); _block.Post(new Timing("foo", 200)); _block.Post(new Timing("foo", 300)); _block.Post(new Timing("foo", 400)); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(); _outputBuffer.GraphiteLines.Any(p => p.Name == "foo.p90").ShouldBe(true); _outputBuffer["foo.p90"].ShouldBe(400); }
public void WriteFourLatencies_PercentileLogged_Success() { _block = TimedLatencyPercentileAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, 90, null, _log.Object); _block.Post(new Timing("foo", 100)); _block.Post(new Timing("foo", 200)); _block.Post(new Timing("foo", 300)); _block.Post(new Timing("foo", 400)); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(); Assert.IsTrue(_outputBuffer.GraphiteLines.Any(p => p.Name == "foo.p90")); Assert.AreEqual(400, _outputBuffer["foo.p90"]); }
public void WriteTwoLatencies_CalulateMinMaxMeanSum_Success() { _block = TimedLatencyAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, _log.Object); var pulseDate = DateTime.Now; _block.Post(new Timing("foo", 5)); _block.Post(new Timing("foo", 15)); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(pulseDate); Assert.AreEqual(15, _outputBuffer["foo.max"]); Assert.AreEqual(5, _outputBuffer["foo.min"]); Assert.AreEqual(10, _outputBuffer["foo.mean"]); Assert.AreEqual(2, _outputBuffer["foo.count"]); Assert.AreEqual(20, _outputBuffer["foo.sum"]); }
public void WriteMinAndMaxLatencies_Success() { _block = TimedLatencyAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, _log.Object); var pulseDate = DateTime.Now; _block.Post(new Timing("foo.bar", 100)); _block.Post(new Timing("foo.bar", 200)); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(pulseDate); Assert.AreEqual(100, _outputBuffer["foo.bar.min"]); Assert.AreEqual(200, _outputBuffer["foo.bar.max"]); Assert.AreEqual(150, _outputBuffer["foo.bar.mean"]); Assert.AreEqual(300, _outputBuffer["foo.bar.sum"]); Assert.AreEqual(2, _outputBuffer["foo.bar.count"]); }
public void WriteFourLatencies_PercentileLogged_Success() { _block = TimedLatencyPercentileAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, 90, null, _log.Object); _block.Post(new Timing("foo", 100)); _block.Post(new Timing("foo", 200)); _block.Post(new Timing("foo", 300)); _block.Post(new Timing("foo", 400)); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(); Assert.IsTrue(_outputBuffer.Items.Any(p => p.Name == "foo.p90")); Assert.AreEqual(400, _outputBuffer["foo.p90"]); }
public void WriteLatenciesToTwoBuckets_MeasurementsSeparate_Success() { _block = TimedLatencyPercentileAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, 80, null); var pulseDate = DateTime.Now; // Bucket one TestUtility.Range(5, false).ForEach(p => _block.Post(new Timing("foo", p * 100))); // Bucket two TestUtility.Range(5, false).ForEach(p => _block.Post(new Timing("bar", p * 100))); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(pulseDate); _outputBuffer["foo.p80"].ShouldBe(400); _outputBuffer["bar.p80"].ShouldBe(400); _outputBuffer.Items.Count.ShouldBe(1); }
public void WriteTwoLatencies_CalulateMinMaxMeanSum_Success() { _block = TimedLatencyAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, true, _log.Object); var pulseDate = DateTime.Now; _block.Post(new Timing("foo", 5)); _block.Post(new Timing("foo", 15)); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(pulseDate); Assert.AreEqual(15, _outputBuffer["foo.max"]); Assert.AreEqual(5, _outputBuffer["foo.min"]); Assert.AreEqual(10, _outputBuffer["foo.mean"]); Assert.AreEqual(2, _outputBuffer["foo.count"]); Assert.AreEqual(20, _outputBuffer["foo.sum"]); }
public void WriteLatenciesToTwoBuckets_MeasurementsSeparate_Success() { _block = TimedLatencyPercentileAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, 80, null, _log.Object); var pulseDate = DateTime.Now; // Bucket one TestUtility.Range(5, false).ForEach(p => _block.Post(new Timing("foo", p * 100))); // Bucket two TestUtility.Range(5, false).ForEach(p => _block.Post(new Timing("bar", p * 100))); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(pulseDate); Assert.AreEqual(400, _outputBuffer["foo.p80"]); Assert.AreEqual(400, _outputBuffer["bar.p80"]); Assert.AreEqual(1, _outputBuffer.Items.Count); }
public void LogOneSet_OneGraphiteLine_NoTimeChange_NoOutput_Success() { _block.Post(new Calendargram("foo.set", "baz", "h")); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(); _block.CompleteAndWait(); Assert.AreEqual(0, _outputBuffer.Items.Count); }
public void WriteLatenciesToTwoBuckets_MeasurementsSeparate_Success() { _block = TimedLatencyAggregatorBlockFactory.CreateBlock(_outputBuffer, String.Empty, _intervalService, true, _log.Object); var pulseDate = DateTime.Now; // Bucket one TestUtility.Range(5, false).ForEach(p => _block.Post(new Timing("foo", p * 100))); // Bucket two TestUtility.Range(5, false).ForEach(p => _block.Post(new Timing("bar", p * 100))); _block.WaitUntilAllItemsProcessed(); _intervalService.Pulse(pulseDate); Assert.AreEqual(5, _outputBuffer["foo.count"]); Assert.AreEqual(100, _outputBuffer["foo.min"]); Assert.AreEqual(500, _outputBuffer["foo.max"]); Assert.AreEqual(300, _outputBuffer["foo.mean"]); Assert.AreEqual(1500, _outputBuffer["foo.sum"]); Assert.AreEqual(550000, _outputBuffer["foo.sumSquares"]); Assert.AreEqual(5, _outputBuffer["bar.count"]); Assert.AreEqual(100, _outputBuffer["bar.min"]); Assert.AreEqual(500, _outputBuffer["bar.max"]); Assert.AreEqual(300, _outputBuffer["bar.mean"]); Assert.AreEqual(1500, _outputBuffer["bar.sum"]); Assert.AreEqual(550000, _outputBuffer["bar.sumSquares"]); Assert.AreEqual(12, _outputBuffer.GraphiteLines.Count); }