public HistogramBuckets(HistogramBucketKind kind, double start, double inc, uint count) { Kind = kind; Start = start; Inc = inc; Count = count; }
static unsafe HistogramBuckets ReadBuckets(ref BucketOpts buckets) { if (buckets.Count == 0) { throw new Exception("Tried to register histogram with no buckets"); } var typeStr = Marshal.PtrToStringAnsi(buckets.Kind); HistogramBucketKind kind = typeStr switch { "linear" => HistogramBucketKind.Linear, "exponential" => HistogramBucketKind.Exponential, _ => throw new Exception($"Invalid metric buckets type {typeStr}") }; return(new HistogramBuckets(kind, buckets.Start, buckets.Increment, buckets.Count)); }