public void LastValueAggregatorAggregatesCorrectly()
        {
            // create an aggregator
            LastValueAggregator <long> aggregator = new LastValueAggregator <long>();
            var sum = aggregator.ToMetricData() as SumData <long>;

            // we start with 0.
            Assert.Equal(0, sum.Sum);

            aggregator.Update(10);
            aggregator.Update(20);
            aggregator.Update(30);
            aggregator.Update(40);

            aggregator.Checkpoint();
            sum = aggregator.ToMetricData() as SumData <long>;
            Assert.Equal(40, sum.Sum);
        }
Esempio n. 2
0
 /// <summary>
 /// Process the observer metric.
 /// </summary>
 /// <param name="meterName">the name of the meter, used as a namespace for the metric instruments.</param>
 /// <param name="metricName">the name of the observer.</param>
 /// <param name="labelSet">the labelSet associated with observer value.</param>
 /// <param name="lastValueAggregator">the aggregator from which raw values can be obtained.</param>
 public abstract void ProcessObserver(string meterName, string metricName, LabelSet labelSet, LastValueAggregator <double> lastValueAggregator);
 public void LastValueAggregatorSupportsDouble()
 {
     LastValueAggregator <double> aggregator = new LastValueAggregator <double>();
 }
 public void LastValueAggregatorSupportsLong()
 {
     LastValueAggregator <long> aggregator = new LastValueAggregator <long>();
 }
Esempio n. 5
0
 public override void ProcessObserver(string meterName, string metricName, LabelSet labelSet, LastValueAggregator <double> lastValueAggregator)
 {
     throw new NotImplementedException();
 }
 public override void ProcessObserver(string meterName, string metricName, LabelSet labelSet, LastValueAggregator <long> lastValueAggregator)
 {
 }
Esempio n. 7
0
 public override void ProcessObserver(string meterName, string metricName, LabelSet labelSet, LastValueAggregator <long> lastValueAggregator)
 {
     observations.Add(new Tuple <string, LabelSet, long>(metricName, labelSet, lastValueAggregator.ValueFromLastCheckpoint()));
 }