using System.Collections.Generic; using System.Diagnostics.Metrics; namespace StellaOps.Cryptography; internal static class CryptoProviderMetrics { private static readonly Meter Meter = new("stellaops.crypto", "1.0.0"); private static readonly Counter ProviderResolutionCounter = Meter.CreateCounter("crypto_provider_resolutions_total", description: "Count of successful provider resolutions."); private static readonly Counter ProviderResolutionFailureCounter = Meter.CreateCounter("crypto_provider_resolution_failures_total", description: "Count of failed provider resolutions."); public static void RecordProviderResolution(string providerName, CryptoCapability capability, string algorithmId) { ProviderResolutionCounter.Add(1, new KeyValuePair("provider", providerName), new KeyValuePair("capability", capability.ToString()), new KeyValuePair("algorithm", algorithmId)); } public static void RecordProviderResolutionFailure(CryptoCapability capability, string algorithmId) { ProviderResolutionFailureCounter.Add(1, new KeyValuePair("capability", capability.ToString()), new KeyValuePair("algorithm", algorithmId)); } }