Ejemplo n.º 1
0
        private static void AddStatsMetric(GaugeAggregator aggregator, string statName, double value)
        {
            var statsMetric = new StatsMetric
            {
                MetricType   = MetricType.Gauge,
                StatName     = statName,
                NumericValue = value,
            };

            aggregator.OnNewValue(ref statsMetric);
        }
Ejemplo n.º 2
0
        public void OnNewValue()
        {
            var handler    = new BufferBuilderHandlerMock();
            var aggregator = new GaugeAggregator(MetricAggregatorParametersFactory.Create(handler.Object));

            AddStatsMetric(aggregator, "s1", 1);
            AddStatsMetric(aggregator, "s1", 2);
            AddStatsMetric(aggregator, "s2", 3);
            aggregator.TryFlush(force: true);

            Assert.AreEqual("s1:2|g|@0,s2:3|g|@0", handler.Value);
        }
Ejemplo n.º 3
0
 public StatsRouter(
     Serializers serializers,
     BufferBuilder bufferBuilder,
     Aggregators optionalAggregators)
 {
     _serializers   = serializers;
     _bufferBuilder = bufferBuilder;
     if (optionalAggregators != null)
     {
         _optionalCountAggregator = optionalAggregators.OptionalCount;
         _optionalGaugeAggregator = optionalAggregators.OptionalGauge;
         _optionalSetAggregator   = optionalAggregators.OptionalSet;
     }
 }
 public override void ProcessGauge(string meterName, string metricName, LabelSet labelSet, GaugeAggregator <double> gaugeAggregator)
 {
 }
 public override void ProcessGauge(string meterName, string metricName, LabelSet labelSet, GaugeAggregator <long> gaugeAggregator)
 {
     gauges.Add(new Tuple <string, LabelSet, Tuple <long, DateTime> >(metricName, labelSet, gaugeAggregator.ValueFromLastCheckpoint()));
 }
 public override void ProcessGauge(string meterName, string metricName, LabelSet labelSet, GaugeAggregator <double> gaugeAggregator)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Process the gauge 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 counter.</param>
 /// <param name="labelSet">the labelSet associated with counter value.</param>
 /// <param name="gaugeAggregator">the aggregator from which current value can be obtained.</param>
 public abstract void ProcessGauge(string meterName, string metricName, LabelSet labelSet, GaugeAggregator <double> gaugeAggregator);