- gRPC client-server metrics collection - PeriodicTimer-based 5-second sampling - Delta encoding with configurable thresholds - Queue/retry mechanism for resilience - ProcessId tracking for duplicate detection - Server-side state reconstruction - Native AOT compilation support - Docker/Podman containerization - PostgreSQL + TimescaleDB persistence layer
45 lines
1022 B
C#
45 lines
1022 B
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace JMonAgent;
|
|
|
|
public record SystemMetrics(
|
|
string MachineName,
|
|
string OSDescription,
|
|
double CpuUsagePercentage,
|
|
long MemoryUsedBytes,
|
|
long MemoryTotalBytes,
|
|
long SwapUsedBytes,
|
|
long SwapTotalBytes,
|
|
long DiskUsedBytes,
|
|
long DiskTotalBytes,
|
|
string DiskMountPoint,
|
|
DateTime Timestamp,
|
|
string IpAddress,
|
|
string HwId,
|
|
int ProcessId
|
|
);
|
|
|
|
public record DeltaMetrics(
|
|
string MachineName,
|
|
string? OSDescription,
|
|
double? CpuUsagePercentage,
|
|
long? MemoryUsedBytes,
|
|
long? MemoryTotalBytes,
|
|
long? SwapUsedBytes,
|
|
long? SwapTotalBytes,
|
|
long? DiskUsedBytes,
|
|
long? DiskTotalBytes,
|
|
string? DiskMountPoint,
|
|
DateTime Timestamp,
|
|
string? IpAddress,
|
|
string? HwId,
|
|
int ProcessId
|
|
);
|
|
|
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
|
[JsonSerializable(typeof(SystemMetrics))]
|
|
[JsonSerializable(typeof(DeltaMetrics))]
|
|
internal partial class MetricsJsonContext : JsonSerializerContext
|
|
{
|
|
}
|