Exemple #1
0
        /// <inheritdoc/>
        protected override void Write(IMetricReadingBatch batch, DateTime timestamp)
        {
            var countSnapshot = Interlocked.Exchange(ref _count, 0);

            if (countSnapshot == 0)
            {
                return;
            }

            batch.Add(
                CreateReading(countSnapshot, timestamp)
                );
        }
        /// <inheritdoc/>
        protected override void Write(IMetricReadingBatch batch, DateTime timestamp)
        {
            var val = _getValueFunc();

            if (!val.HasValue || double.IsNaN(val.Value))
            {
                return;
            }

            batch.Add(
                CreateReading(val.Value, timestamp)
                );
        }
Exemple #3
0
        /// <inheritdoc/>
        protected override void Write(IMetricReadingBatch batch, DateTime timestamp)
        {
            var val = _getCountFunc();

            if (!val.HasValue || val.Value == 0)
            {
                return;
            }

            batch.Add(
                CreateReading(val.Value, timestamp)
                );
        }
        /// <inheritdoc/>
        protected override void Write(IMetricReadingBatch batch, DateTime timestamp)
        {
            var value = Interlocked.Exchange(ref _value, double.NaN);

            if (double.IsNaN(value))
            {
                return;
            }

            batch.Add(
                CreateReading(value, timestamp)
                );
        }
Exemple #5
0
        /// <inheritdoc/>
        protected override void Write(IMetricReadingBatch batch, DateTime timestamp)
        {
            var pending = Interlocked.Exchange(ref _pendingMetrics, new ConcurrentBag <PendingMetric>());

            if (pending == null || pending.Count == 0)
            {
                return;
            }

            foreach (var p in pending)
            {
                batch.Add(
                    CreateReading(p.Value, p.Time)
                    );
            }
        }