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" }; }
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(); }
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; }
public ReporterTests(MetricsReportingFixture fixture) { _fixture = fixture; _reporters = new MetricsReporterCollection(); }