Timing() public method

public Timing ( long milliseconds, double sampleRate, string statBucket ) : string
milliseconds long
sampleRate double
statBucket string
return string
Ejemplo n.º 1
0
        public void TimingIsCorrect()
        {
            // Arrange
            var target = new StatsDMessageFormatter();

            // Act
            string actual = target.Timing(_value, _statBucket);

            // Assert
            actual.ShouldBe(string.Format(CultureInfo.InvariantCulture, "{0}:{1}|ms", _statBucket, _value));
        }
        public static void TimingMetricsAreFormattedCorrectly()
        {
            string statBucket   = "timing-bucket";
            long   milliseconds = new Random().Next(1000);

            var target = new StatsDMessageFormatter();

            string actual = target.Timing(milliseconds, statBucket);

            actual.ShouldBe(string.Format(CultureInfo.InvariantCulture, "{0}:{1:d}|ms", statBucket, milliseconds));
        }
Ejemplo n.º 3
0
        public void ValuesArePrefixed()
        {
            var prefix = "foo";
            var target = new StatsDMessageFormatter(prefix);

            var actualGauge     = target.Gauge(_value, _statBucket);
            var actualDecrement = target.Decrement(_statBucket);
            var actualIncrement = target.Increment(_statBucket);
            var actualTiming    = target.Timing(_value, _statBucket);

            actualGauge.ShouldStartWith($"{prefix}.");
            actualDecrement.ShouldStartWith($"{prefix}.");
            actualIncrement.ShouldStartWith($"{prefix}.");
            actualTiming.ShouldStartWith($"{prefix}.");
        }
 public void Timing(TimeSpan duration, string bucket)
 {
     _transport.Send(_formatter.Timing(Convert.ToInt64(duration.TotalMilliseconds), bucket));
 }