Example #1
0
 private protected override void CollectAndSerializeImpl(IMetricsSerializer serializer)
 {
     if (this._timestamp == 0)
     {
         serializer.WriteMetric(_identifier, Value);
     }
     else
     {
         serializer.WriteMetric(_identifier, Value, this._timestamp);
     }
 }
Example #2
0
            private protected override void CollectAndSerializeImpl(IMetricsSerializer serializer)
            {
                // We output sum.
                // We output count.
                // We output each bucket in order of increasing upper bound.

                serializer.WriteMetric(_sumIdentifier, _sum.Value);
                serializer.WriteMetric(_countIdentifier, _bucketCounts.Sum(b => b.Value));

                var cumulativeCount = 0L;

                for (var i = 0; i < _bucketCounts.Length; i++)
                {
                    cumulativeCount += _bucketCounts[i].Value;

                    serializer.WriteMetric(_bucketIdentifiers[i], cumulativeCount);
                }
            }
Example #3
0
            private protected override void CollectAndSerializeImpl(IMetricsSerializer serializer)
            {
                // We output sum.
                // We output count.
                // We output quantiles.

                var now = DateTime.UtcNow;

                double count;
                double sum;
                var    values = new List <(double quantile, double value)>(_objectives.Count);

                lock (_bufLock)
                {
                    lock (_lock)
                    {
                        // Swap bufs even if hotBuf is empty to set new hotBufExpTime.
                        SwapBufs(now);
                        FlushColdBuf();

                        count = _count;
                        sum   = _sum;

                        for (var i = 0; i < _sortedObjectives.Length; i++)
                        {
                            var quantile = _sortedObjectives[i];
                            var value    = _headStream.Count == 0 ? double.NaN : _headStream.Query(quantile);

                            values.Add((quantile, value));
                        }
                    }
                }

                serializer.WriteMetric(_sumIdentifier, sum);
                serializer.WriteMetric(_countIdentifier, count);

                for (var i = 0; i < values.Count; i++)
                {
                    serializer.WriteMetric(_quantileIdentifiers[i], values[i].value);
                }
            }
Example #4
0
 private protected override void CollectAndSerializeImpl(IMetricsSerializer serializer)
 {
     serializer.WriteMetric(_identifier, Value);
 }
Example #5
0
 internal override void CollectAndSerializeImpl(IMetricsSerializer serializer)
 {
     serializer.WriteMetric(_identifier, Value);
 }