Skip to content

Metrics

System Metrics

Enable with EnableMetrics = true:

MetricKeyTypeDescription
CPU Usagecpu_percentdoubleProcess CPU usage as percentage
Memorymemory_mbdoubleProcess working set in MB
Total Memorytotal_memory_mbdoubleTotal available system memory in MB
Disk Usagedisk_usage_percentdoubleRoot drive usage percentage
Thread Countthread_countintNumber of active threads

How CPU is Calculated

CPU % = (TotalProcessorTime / Uptime) * 100 / ProcessorCount

This gives the average CPU usage of the process since it started.

How Memory is Measured

  • Memory (MB): Process.WorkingSet64 — physical memory used by the process
  • Total Memory (MB): GC.GetGCMemoryInfo().TotalAvailableMemoryBytes — total system memory

Disk Usage

Measured from the root drive where the application runs (AppContext.BaseDirectory).

Request Tracking

Enable with EnableRequestTracking = true and add the middleware:

csharp
app.UseHubMonTracking();
MetricKeyTypeDescription
Requests/Minrequests_per_minutelongHTTP requests in the last minute
Active Connectionsactive_connectionslongCurrent concurrent HTTP connections

TIP

Request tracking requires the ASP.NET Core middleware pipeline. It is not available in Worker Services.

Viewing Metrics

All metrics are visible in the HubMon dashboard under each service instance. Historical data is retained based on your subscription plan.

Released under the MIT License.