Пример #1
0
 public HistogramBuckets(HistogramBucketKind kind, double start, double inc, uint count)
 {
     Kind  = kind;
     Start = start;
     Inc   = inc;
     Count = count;
 }
Пример #2
0
        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));
        }