예제 #1
0
        private async Task FlushMetrics(IMetrics metrics, CancellationToken cancellationToken, IReportMetrics reporter)
        {
            try
            {
                Logger.ReportRunning(reporter);

                var result = await reporter.FlushAsync(metrics.Snapshot.Get(reporter.Filter), cancellationToken);

                if (result)
                {
                    metrics.Measure.Counter.Increment(_successCounter, reporter.GetType().FullName);
                }
                else
                {
                    metrics.Measure.Counter.Increment(_failedCounter, reporter.GetType().FullName);
                    Logger.ReportFailed(reporter);
                }
            }
            catch (Exception ex)
            {
                metrics.Measure.Counter.Increment(_failedCounter, reporter.GetType().FullName);
                Logger.ReportFailed(reporter, ex);
            }
        }
예제 #2
0
        public async Task <bool> FlushAsync(MetricsDataValueSource metricsData, CancellationToken cancellationToken = default(CancellationToken))
        {
            var result = await _httpReporter.FlushAsync(metricsData, cancellationToken);

            return(result);
        }