public Task TimerAsync(string name, int milliseconds) {
            _logger.Trace(() => $"Timer name={name} milliseconds={milliseconds} buffered={_buffered}");
            var entry = new MetricEntry { Name = name, Type = MetricType.Timing, Timing = milliseconds };
            if (!_buffered)
                return SubmitMetricAsync(entry);

            _queue.Enqueue(entry);

            return Task.CompletedTask;
        }
        public Task GaugeAsync(string name, double value) {
            _logger.Trace(() => $"Gauge name={name} value={value} buffered={_buffered}");
            var entry = new MetricEntry { Name = name, Type = MetricType.Gauge, Gauge = value };
            if (!_buffered)
                return SubmitMetricAsync(entry);

            _queue.Enqueue(entry);

            return Task.CompletedTask;
        }
        public Task CounterAsync(string name, int value = 1) {
            _logger.Trace(() => $"Counter name={name} value={value} buffered={_buffered}");
            var entry = new MetricEntry { Name = name, Type = MetricType.Counter, Counter = value };
            if (!_buffered)
                return SubmitMetricAsync(entry);

            _queue.Enqueue(entry);

            return Task.CompletedTask;
        }
Beispiel #4
0
        public Task TimerAsync(string name, int milliseconds)
        {
            _logger.Trace(() => $"Timer name={name} milliseconds={milliseconds} buffered={_buffered}");
            var entry = new MetricEntry {
                Name = name, Type = MetricType.Timing, Timing = milliseconds
            };

            if (!_buffered)
            {
                return(SubmitMetricAsync(entry));
            }

            _queue.Enqueue(entry);

            return(TaskHelper.Completed);
        }
Beispiel #5
0
        public Task GaugeAsync(string name, double value)
        {
            _logger.Trace(() => $"Gauge name={name} value={value} buffered={_buffered}");
            var entry = new MetricEntry {
                Name = name, Type = MetricType.Gauge, Gauge = value
            };

            if (!_buffered)
            {
                return(SubmitMetricAsync(entry));
            }

            _queue.Enqueue(entry);

            return(TaskHelper.Completed);
        }
Beispiel #6
0
        public Task CounterAsync(string name, int value = 1)
        {
            _logger.Trace(() => $"Counter name={name} value={value} buffered={_buffered}");
            var entry = new MetricEntry {
                Name = name, Type = MetricType.Counter, Counter = value
            };

            if (!_buffered)
            {
                return(SubmitMetricAsync(entry));
            }

            _queue.Enqueue(entry);

            return(TaskHelper.Completed);
        }
 private Task SubmitMetricAsync(MetricEntry metric)
 {
     return(SubmitMetricsAsync(new List <MetricEntry> {
         metric
     }));
 }
 private void SubmitMetric(MetricEntry metric)
 {
     SubmitMetricsAsync(new List <MetricEntry> {
         metric
     }).AnyContext().GetAwaiter().GetResult();
 }
 private Task SubmitMetricAsync(MetricEntry metric) {
     return SubmitMetricsAsync(new List<MetricEntry> { metric });
 }