using System;
using System.Collections.Generic;

namespace EonaCat.LogStack.Telemetry;

/// <summary>
/// Runtime health information exposed by telemetry.
/// </summary>
public sealed class TelemetryHealth
{
    public bool IsHealthy { get; set; } = true;
    public DateTime StartedUtc { get; set; } = DateTime.UtcNow;
    public long EventsProcessed { get; set; }
    public long EventsFailed { get; set; }
    public long ActiveSpans { get; set; }
    public Dictionary<string, string> Checks { get; set; } = new();

    public double FailureRate =>
        EventsProcessed == 0 ? 0 : EventsFailed * 100d / EventsProcessed;
}
