AdapterMetricsSamplerService
Namespace: Meshmakers.Octo.Sdk.Common.Adapters
Periodically samples the adapter process's CPU, memory and thread usage and pushes each sample to the communication controller. The controller keeps a short in-memory history per adapter to back the UI sparklines.
First sample of a session is consumed as a CPU baseline (no point published) because CPU% is computed from the delta between two TotalProcessorTime readings. Subsequent samples emit a 0..100% value normalised across all available cores.
public class AdapterMetricsSamplerService : BackgroundService, IHostedService, IDisposable
Inheritance Object → BackgroundService → AdapterMetricsSamplerService
Implements IHostedService, IDisposable
Properties
ExecuteTask
public Task ExecuteTask { get; }
Property Value
Constructors
AdapterMetricsSamplerService(IAdapterHubClient, IOptions<AdapterOptions>)
Constructor
public AdapterMetricsSamplerService(IAdapterHubClient adapterHubClient, IOptions<AdapterOptions> adapterOptions)
Parameters
adapterHubClient IAdapterHubClient
adapterOptions IOptions<AdapterOptions>
Methods
ExecuteAsync(CancellationToken)
protected Task ExecuteAsync(CancellationToken stoppingToken)
Parameters
stoppingToken CancellationToken