Example #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);
        }
Example #2
0
        private bool RouteMetric(ref StatsMetric metric)
        {
            switch (metric.MetricType)
            {
            case MetricType.Count:
                if (_optionalCountAggregator != null)
                {
                    _optionalCountAggregator.OnNewValue(ref metric);
                    return(false);
                }

                break;

            case MetricType.Gauge:
                if (_optionalGaugeAggregator != null)
                {
                    _optionalGaugeAggregator.OnNewValue(ref metric);
                    return(false);
                }

                break;

            case MetricType.Set:
                if (_optionalSetAggregator != null)
                {
                    _optionalSetAggregator.OnNewValue(ref metric);
                    return(false);
                }

                break;

            default:
                break;
            }

            this._serializers.MetricSerializer.SerializeTo(ref metric, _serializedMetric);
            return(true);
        }