Skip to content

BlueprintSystemMetricsReporter

github-actions[bot] edited this page Dec 6, 2026 · 3 revisions

BlueprintSystemMetricsReporter

BlueprintSystemMetricsReporter is the abstract base class for system metrics reporting in the Blueprint.SystemMetricsReporter namespace. It defines the API for writing, reading, and deleting reports. The SQL Server implementation is SqlSystemMetricsReporter.

Lifecycle and retention

Supply a positive TimeSpan for Retention when constructing a reporter. The property is read-only. Use TimeSpan.FromMinutes(...), TimeSpan.FromHours(...), or TimeSpan.FromDays(...) to specify the duration. Call Initialize() before using the reporter, and dispose it when finished. The application decides when to write reports and when to delete expired reports.

Methods

Method Behavior
WriteReport() Collects and stores one sample.
ReadReports(TimeSpan period, string? machineName = null) Returns a read-only list of samples from the last period, ordered from newest to oldest.
ReadMachineNames() Returns a List<string> of distinct machine names in ascending order.
DeleteExpiredReports() Deletes reports whose UTC sample time is strictly earlier than the current UTC time minus Retention.

Call ReadReports(TimeSpan.FromMinutes(30)) to read the last 30 minutes for all machines. To read a single machine, pass its name as the second argument, for example ReadReports(TimeSpan.FromMinutes(30), "SERVER-01"). The period must be positive. A supplied machine name must contain 1 to 255 characters and cannot consist only of whitespace. The read-only list includes reports at both ends of the interval. Both read methods return an empty list when there are no matches.

Samples

A SystemMetricsSample contains the UTC time at which sampling began and the originating machine name. CPU usage is a percentage. Total and available physical RAM and the application process working set are recorded in bytes. An unavailable measurement is recorded as zero.

User manual

Clone this wiki locally