Table of Contents

Class SendAlertService

Namespace
adas_core.Infrastructure.Services
Assembly
adas-core.Infrastructure.dll
public class SendAlertService : ISendAlertService
Inheritance
SendAlertService
Implements
Inherited Members
Extension Methods

Constructors

SendAlertService(IOptions<RabbitMqSettings>, ILogger<SendAlertService>)

public SendAlertService(IOptions<RabbitMqSettings> rabbitMqSettings, ILogger<SendAlertService> logger)

Parameters

rabbitMqSettings IOptions<RabbitMqSettings>
logger ILogger<SendAlertService>

Methods

GetApiClients()

Asynchronously retrieves a list of API clients by delegating to the underlying data retrieval method.

public Task<List<ApiClients>> GetApiClients()

Returns

Task<List<ApiClients>>

A task representing the asynchronous operation, containing the list of ApiClients instances retrieved.

GetConsumedCpu()

Retrieves the CPU consumption of the current process as a Performance measurement. Calculates usage from total processor time divided by processor count, and returns a default Performance instance if the underlying process query fails.

public Performance GetConsumedCpu()

Returns

Performance

A Performance object describing the CPU usage percentage, total capacity, and unit. If an error occurs, a default Performance instance is returned and the exception is logged.

GetConsumedRam()

Retrieves the current RAM consumption in gigabytes, returning it as a Performance metric where the total and consumed values are reported as equal with a consumption percentage of 100. If an error occurs while retrieving the memory information, the exception is logged and an empty Performance object is returned.

public Performance GetConsumedRam()

Returns

Performance

A Performance object representing the RAM usage in GB; returns an empty Performance object if the memory retrieval fails.

GetConsumedStorage(DriveInfo)

Calculates the consumed storage for the specified drive, returning total and consumed values in gigabytes along with the consumption percentage. If the drive's total size is zero, the percentage is not computed and the total remains zero. Any errors encountered during calculation are logged and an empty Performance object is returned.

public Performance GetConsumedStorage(DriveInfo drive)

Parameters

drive DriveInfo

The drive whose storage consumption is to be measured.

Returns

Performance

A Performance instance containing the consumed storage, total storage, percentage consumed, and the unit (GB) for the drive.

GetPerformance()

Retrieves performance data from hospitals, including CPU, RAM, and storage consumption metrics. Logs and suppresses any errors encountered while collecting the data, returning the successfully gathered metrics.

public List<Performance> GetPerformance()

Returns

List<Performance>

A list of Performance entries containing the collected performance metrics; returns an empty list if all collection attempts fail.

GetQueues()

Asynchronously retrieves the list of available queues from the Rabbit messaging system. If the Rabbit connection string is not defined in the web config, an error is logged and an empty list is returned.

public Task<List<Queue>> GetQueues()

Returns

Task<List<Queue>>

A task that represents the asynchronous operation. The task result contains a list of Queue objects, or an empty list if the Rabbit connection string is not configured.