using System.Collections.Generic;
using System.Diagnostics.Metrics;

namespace StellaOps.Vexer.Policy;

internal static class VexPolicyTelemetry
{
    private const string MeterName = "StellaOps.Vexer.Policy";
    private const string MeterVersion = "1.0.0";

    private static readonly Meter Meter = new(MeterName, MeterVersion);
    private static readonly Counter<long> PolicyReloads = Meter.CreateCounter<long>("vex.policy.reloads", unit: "events");

    public static void RecordReload(string revisionId, string version, int issueCount)
    {
        var tags = new KeyValuePair<string, object?>[]
        {
            new("revision", revisionId),
            new("version", version),
            new("issues", issueCount),
        };
        PolicyReloads.Add(1, tags);
    }
}
