Example #1
0
        private static MetricValue GetConvertedMetric(MetricValueBlob m)
        {
            // If count is not supplied, we assume 1, so the total / average relation works.
            var metricValue = new MetricValue
            {
                Count     = m.count == 0 ? 1 : m.count,
                Maximum   = m.maximum,
                Minimum   = m.minimum,
                Timestamp = m.time,
            };

            // In case the RP doesn't populate average, we calculate average from total / count.
            if (m.average == 0 && m.total != 0)
            {
                metricValue.Average = m.total / metricValue.Count;
            }
            else
            {
                metricValue.Average = m.average;
            }

            // In case the RP doesn't populate total, we calculate total from the average * count.
            if (m.total == 0 && m.average != 0)
            {
                metricValue.Total = m.average * metricValue.Count;
            }
            else
            {
                metricValue.Total = m.total;
            }

            return(metricValue);
        }
Example #2
0
        private static void Aggregate(MetricValue lastSeen, MetricValueBlob m)
        {
            // If count is not supplied, we assume 1, so the total / average relation works.
            lastSeen.Count += m.count == 0 ? 1 : m.count;

            // In case the RP doesn't populate total, we calculate total from the average * count.
            if (m.total == 0 && m.average != 0)
            {
                lastSeen.Total += m.average * lastSeen.Count;
            }
            else
            {
                lastSeen.Total += m.total;
            }

            if (m.maximum > lastSeen.Maximum)
            {
                lastSeen.Maximum = m.maximum;
            }

            if (m.minimum < lastSeen.Minimum)
            {
                lastSeen.Minimum = m.minimum;
            }
        }
 private static MetricValue GetConvertedMetric(MetricValueBlob m)
 {
     return(new MetricValue
     {
         Average = m.average,
         Count = m.count,
         Maximum = m.maximum,
         Minimum = m.minimum,
         Timestamp = m.time,
         Total = m.total
     });
 }
        private static void Aggregate(MetricValue lastSeen, MetricValueBlob m)
        {
            lastSeen.Average += m.total;
            lastSeen.Total   += m.total;
            lastSeen.Count   += m.count;

            if (m.maximum > lastSeen.Maximum)
            {
                lastSeen.Maximum = m.maximum;
            }

            if (m.minimum < lastSeen.Minimum)
            {
                lastSeen.Minimum = m.minimum;
            }
        }
        private static MetricValue GetConvertedMetric(MetricValueBlob m)
        {
            // If count is not supplied, we assume 1, so the total / average relation works.
            var metricValue = new MetricValue
            {
                Count = m.count == 0 ? 1 : m.count,
                Maximum = m.maximum,
                Minimum = m.minimum,
                Timestamp = m.time,
            };

            // In case the RP doesn't populate average, we calculate average from total / count.
            if (m.average == 0 && m.total != 0)
            {
                metricValue.Average = m.total / metricValue.Count;
            }
            else
            {
                metricValue.Average = m.average;
            }

            // In case the RP doesn't populate total, we calculate total from the average * count.
            if (m.total == 0 && m.average != 0)
            {
                metricValue.Total = m.average * metricValue.Count;
            }
            else
            {
                metricValue.Total = m.total;
            }

            return metricValue;
        }
        private static void Aggregate(MetricValue lastSeen, MetricValueBlob m)
        {
            // If count is not supplied, we assume 1, so the total / average relation works.
            lastSeen.Count += m.count == 0 ? 1 : m.count;

            // In case the RP doesn't populate total, we calculate total from the average * count.
            if (m.total == 0 && m.average != 0)
            {
                lastSeen.Total += m.average * lastSeen.Count;
            }
            else
            {
                lastSeen.Total += m.total;
            }

            if (m.maximum > lastSeen.Maximum)
            {
                lastSeen.Maximum = m.maximum;
            }

            if (m.minimum < lastSeen.Minimum)
            {
                lastSeen.Minimum = m.minimum;
            }
        }
 private int CompareMetrics(MetricValueBlob a, MetricValueBlob b)
 {
     return a.time.CompareTo(b.time);
 }
Example #8
0
 private int CompareMetrics(MetricValueBlob a, MetricValueBlob b)
 {
     return(a.time.CompareTo(b.time));
 }
 private static MetricValue GetConvertedMetric(MetricValueBlob m)
 {
     return new MetricValue
     {
         Average = m.average,
         Count = m.count,
         Maximum = m.maximum,
         Minimum = m.minimum,
         Timestamp = m.time,
         Total = m.total
     };
 }
        private static void Aggregate(MetricValue lastSeen, MetricValueBlob m)
        {
            lastSeen.Average += m.total;
            lastSeen.Total += m.total;
            lastSeen.Count += m.count;

            if (m.maximum > lastSeen.Maximum)
            {
                lastSeen.Maximum = m.maximum;
            }

            if (m.minimum < lastSeen.Minimum)
            {
                lastSeen.Minimum = m.minimum;
            }
        }