コード例 #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);
        }
コード例 #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;
            }
        }
コード例 #3
0
 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
     });
 }
コード例 #4
0
        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;
            }
        }
コード例 #5
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;
        }
コード例 #6
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;
            }
        }
コード例 #7
0
 private int CompareMetrics(MetricValueBlob a, MetricValueBlob b)
 {
     return a.time.CompareTo(b.time);
 }
コード例 #8
0
 private int CompareMetrics(MetricValueBlob a, MetricValueBlob b)
 {
     return(a.time.CompareTo(b.time));
 }
コード例 #9
0
 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
     };
 }
コード例 #10
0
        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;
            }
        }