Exemplo n.º 1
0
        public void OnNewValue(ref StatsMetric metric)
        {
            var key = _aggregator.CreateKey(metric);

            if (_aggregator.TryGetValue(ref key, out var _))
            {
                _aggregator.Update(ref key, metric);
            }
        public void OnNewValue(ref StatsMetric metric)
        {
            var key = _aggregator.CreateKey(metric);

            if (_aggregator.TryGetValue(ref key, out var v))
            {
                v.NumericValue += metric.NumericValue;
                _aggregator.Update(ref key, v);
            }
        public void OnNewValue(ref StatsMetric metric)
        {
            string value = metric.StringValue;
            var    key   = _aggregator.CreateKey(metric);

            if (_aggregator.TryGetValue(ref key, out var v))
            {
                v.Values.Add(value);
                _aggregator.Update(ref key, v);
            }
Exemplo n.º 4
0
        public void OnNewValue(ref StatsMetric metric)
        {
            var key = _aggregator.CreateKey(metric);

            // In order to aggregate count metrics, the sample rate must be the same.
            // On average, calling 1000 times `service.Increment(metricName, 1, sampleRate: 0.5);` generates arround
            // 500 `StatsMetric` objects with `NumericValue = 1` and `SampleRate = 0.5`. From the DogStatsd server perspective,
            // it is equivalent to generate 500 `StatsMetric` objects with `NumericValue = 2` and `SampleRate = 1`.
            // This code normalizes `StatsMetric.NumericValue` to always have `SampleRate = 1`.
            metric.NumericValue = metric.NumericValue / metric.SampleRate;

            if (_aggregator.TryGetValue(ref key, out var v))
            {
                v.NumericValue += metric.NumericValue;
                _aggregator.Update(ref key, v);
            }