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 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 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 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); }