public static CounterValueSource ToMetricValueSource(this CounterMetric source)
        {
            var items        = source.Items.Select(i => new CounterValue.SetItem(i.Item, i.Count, i.Percent)).ToArray();
            var counterValue = new CounterValue(source.Count, items);

            return(new CounterValueSource(source.Name, ConstantValue.Provider(counterValue), source.Unit, source.Tags));
        }
        public static CounterValueSource FromSerializableMetric(this CounterMetric source)
        {
            var items        = source.Items.Select(i => new CounterValue.SetItem(i.Item, i.Count, i.Percent)).ToArray();
            var counterValue = new CounterValue(source.Count, items);

            return(new CounterValueSource(
                       source.Name,
                       ConstantValue.Provider(counterValue),
                       source.Unit,
                       source.Tags.FromDictionary()));
        }
Esempio n. 3
0
 // ReSharper disable MemberCanBePrivate.Global
 public bool Equals(CounterValue other)
 {
     return(Count == other.Count && Equals(Items, other.Items));
 }