Example #1
0
 /// <summary>
 /// Schedule a generic reporter to be executed at a fixed <paramref name="interval"/>
 /// </summary>
 /// <param name="reporterName">Name of the reporter</param>
 /// <param name="reporter">Function that returns an instance of a reporter</param>
 /// <param name="interval">Interval at which to run the report.</param>
 public MetricsReports WithReporter(string reporterName, Func<Reporter> reporter, TimeSpan interval)
 {
     var report = new ScheduledReporter(reporterName, reporter, this.metricsRegistry, this.healthStatus, interval);
     report.Start();
     this.reports.Add(report);
     return this;
 }
Example #2
0
 /// <summary>
 /// Schedule a Human Readable report to be executed and appended to a text file.
 /// </summary>
 /// <param name="filePath">File where to append the report.</param>
 /// <param name="interval">Interval at which to run the report.</param>
 public MetricsReports WithTextFileReport(string filePath, TimeSpan interval)
 {
     var reporter = new ScheduledReporter("TextFile", () => new TextFileReporter(filePath), this.metricsRegistry, this.healthStatus, interval);
     reporter.Start();
     this.reports.Add(reporter);
     return this;
 }
Example #3
0
 /// <summary>
 /// Schedule a Console Report to be executed and displayed on the console at a fixed <paramref name="interval"/>.
 /// </summary>
 /// <param name="interval">Interval at which to display the report on the Console.</param>
 public MetricsReports WithConsoleReport(TimeSpan interval)
 {
     var reporter = new ScheduledReporter("Console", () => new ConsoleReporter(), this.metricsRegistry, this.healthStatus, interval);
     reporter.Start();
     this.reports.Add(reporter);
     return this;
 }
Example #4
0
 /// <summary>
 /// Configure Metrics to append a line for each metric to a CSV file in the <paramref name="directory"/>.
 /// </summary>
 /// <param name="directory">Directory where to store the CSV files.</param>
 /// <param name="interval">Interval at which to append a line to the files.</param>
 public MetricsReports WithCSVReports(string directory, TimeSpan interval)
 {
     Directory.CreateDirectory(directory);
     var reporter = new ScheduledReporter("CSVFiles", () => new CSVReporter(new CSVFileAppender(directory)), this.metricsRegistry, this.healthStatus, interval);
     reporter.Start();
     this.reports.Add(reporter);
     return this;
 }
 /// <summary>
 /// Schedule a generic reporter to be executed at a fixed <paramref name="interval"/>
 /// </summary>
 /// <param name="report">Function that returns an instance of a reporter</param>
 /// <param name="interval">Interval at which to run the report.</param>
 public MetricsReports WithReport(MetricsReport report, TimeSpan interval)
 {
     var newReport = new ScheduledReporter(report, this.metricsDataProvider, this.healthStatus, interval);
     this.reports.Add(newReport);
     return this;
 }