Exemplo n.º 1
0
        public DefaultMetricsReportRunner(IMetrics metrics, MetricsReporterCollection reporters)
        {
            _metrics   = metrics ?? throw new ArgumentNullException(nameof(metrics));
            _reporters = reporters ?? throw new ArgumentNullException(nameof(reporters));

            _successCounter = new CounterOptions
            {
                Context               = AppMetricsConstants.InternalMetricsContext,
                MeasurementUnit       = Unit.Items,
                ResetOnReporting      = true,
                ReportItemPercentages = false,
                ReportSetItems        = false,
                Name = "report_success"
            };

            _failedCounter = new CounterOptions
            {
                Context               = AppMetricsConstants.InternalMetricsContext,
                MeasurementUnit       = Unit.Items,
                ResetOnReporting      = true,
                ReportItemPercentages = false,
                ReportSetItems        = false,
                Name = "report_failed"
            };
        }
Exemplo n.º 2
0
        public void When_metric_reporter_fails_continues_to_retry()
        {
            var metricsReporter = new TestReporter(TimeSpan.FromMilliseconds(10), false);
            var metrics         = _fixture.Metrics();
            var reporters       = new MetricsReporterCollection {
                metricsReporter
            };
            var reporter = new DefaultMetricsReportRunner(metrics, reporters);
            var token    = new CancellationTokenSource();

            token.CancelAfter(100);

            Action action = () => { reporter.RunAllAsync(token.Token); };

            action.ShouldNotThrow();
        }
Exemplo n.º 3
0
 public MetricsRoot(
     IMetrics metrics,
     MetricsOptions options,
     MetricsFormatterCollection metricsOutputFormatters,
     EnvFormatterCollection envOutputFormatters,
     IMetricsOutputFormatter defaultMetricsOutputFormatter,
     IEnvOutputFormatter defaultEnvOutputFormatter,
     EnvironmentInfoProvider environmentInfoProvider,
     MetricsReporterCollection reporterCollection,
     IRunMetricsReports reporter)
 {
     Options                       = options ?? throw new ArgumentNullException(nameof(options));
     _metrics                      = metrics ?? throw new ArgumentNullException(nameof(metrics));
     ReportRunner                  = reporter ?? throw new ArgumentNullException(nameof(reporter));
     _environmentInfoProvider      = new EnvironmentInfoProvider();
     Reporters                     = reporterCollection ?? new MetricsReporterCollection();
     OutputMetricsFormatters       = metricsOutputFormatters ?? new MetricsFormatterCollection();
     OutputEnvFormatters           = envOutputFormatters ?? new EnvFormatterCollection();
     DefaultOutputMetricsFormatter = defaultMetricsOutputFormatter;
     DefaultOutputEnvFormatter     = defaultEnvOutputFormatter;
     _environmentInfoProvider      = environmentInfoProvider;
 }
Exemplo n.º 4
0
 public ReporterTests(MetricsReportingFixture fixture)
 {
     _fixture   = fixture;
     _reporters = new MetricsReporterCollection();
 }