65 lines
1.6 KiB
C#
65 lines
1.6 KiB
C#
using System;
|
|
|
|
namespace StellaOps.Provcache;
|
|
|
|
/// <summary>
|
|
/// Cache metrics for monitoring and observability.
|
|
/// </summary>
|
|
public sealed record ProvcacheMetrics
|
|
{
|
|
/// <summary>
|
|
/// Total cache requests since startup.
|
|
/// </summary>
|
|
public long TotalRequests { get; init; }
|
|
|
|
/// <summary>
|
|
/// Total cache hits since startup.
|
|
/// </summary>
|
|
public long TotalHits { get; init; }
|
|
|
|
/// <summary>
|
|
/// Total cache misses since startup.
|
|
/// </summary>
|
|
public long TotalMisses { get; init; }
|
|
|
|
/// <summary>
|
|
/// Cache hit rate (0.0 - 1.0).
|
|
/// </summary>
|
|
public double HitRate => TotalRequests == 0 ? 0.0 : (double)TotalHits / TotalRequests;
|
|
|
|
/// <summary>
|
|
/// Average lookup latency in milliseconds.
|
|
/// </summary>
|
|
public double AvgLatencyMs { get; init; }
|
|
|
|
/// <summary>
|
|
/// P99 lookup latency in milliseconds.
|
|
/// </summary>
|
|
public double P99LatencyMs { get; init; }
|
|
|
|
/// <summary>
|
|
/// Current number of entries in cache.
|
|
/// </summary>
|
|
public long CurrentEntryCount { get; init; }
|
|
|
|
/// <summary>
|
|
/// Total invalidations since startup.
|
|
/// </summary>
|
|
public long TotalInvalidations { get; init; }
|
|
|
|
/// <summary>
|
|
/// Valkey cache health status.
|
|
/// </summary>
|
|
public bool ValkeyCacheHealthy { get; init; }
|
|
|
|
/// <summary>
|
|
/// Postgres repository health status.
|
|
/// </summary>
|
|
public bool PostgresRepositoryHealthy { get; init; }
|
|
|
|
/// <summary>
|
|
/// Timestamp when metrics were collected.
|
|
/// </summary>
|
|
public DateTimeOffset CollectedAt { get; init; }
|
|
}
|