using System.Collections.Concurrent;
namespace EonaCat.LogStack.Telemetry;
public sealed class TelemetryMeter
{
    private readonly ConcurrentDictionary<string,Histogram> _histograms = new();
    public MetricsRegistry Counters { get; } = new();
    public void Count(string name,long value=1)=>Counters.Increment(name,value);
    public void Record(string name,double value)=>_histograms.GetOrAdd(name,_=>new()).Record(value);
    public Histogram? GetHistogram(string name)=>_histograms.TryGetValue(name,out var h)?h:null;
}
