예제 #1
0
    def _summarizeData(self, operation, data, total_count):
        failed = 0
        thresholds = [0] * len(self._thresholds)
        durations = []
        for (success, duration) in data:
            if not success:
                failed += 1
            for ctr, item in enumerate(self._thresholds):
                threshold, _ignore_fail_at = item
                if duration > threshold:
                    thresholds[ctr] += 1
            durations.append(duration)

        # Determine PASS/FAIL
        failure = False
        count = len(data)

        if failed * 100.0 / count > self._fail_cut_off:
            failure = True

        for ctr, item in enumerate(self._thresholds):
            _ignore_threshold, fail_at = item
            fail_at = fail_at.get(operation, fail_at["default"])
            if thresholds[ctr] * 100.0 / count > fail_at:
                failure = True

        return (operation, count, ((100.0 * count) / total_count) if total_count else 0.0, failed,) + \
            tuple(thresholds) + \
            (mean(durations), median(durations), stddev(durations), "FAIL" if failure else "")
예제 #2
0
    def _summarizeData(self, operation, data):
        failed = 0
        thresholds = [0] * len(self._thresholds)
        durations = []
        for (success, duration) in data:
            if not success:
                failed += 1
            for ctr, item in enumerate(self._thresholds):
                threshold, _ignore_fail_at = item
                if duration > threshold:
                    thresholds[ctr] += 1
            durations.append(duration)

        # Determine PASS/FAIL
        failure = False
        count = len(data)

        if failed * 100.0 / count > self._fail_cut_off:
            failure = True

        for ctr, item in enumerate(self._thresholds):
            _ignore_threshold, fail_at = item
            fail_at = fail_at.get(operation, fail_at["default"])
            if thresholds[ctr] * 100.0 / count > fail_at:
                failure = True

        return (operation, count, failed,) + \
                tuple(thresholds) + \
                (mean(durations), median(durations), stddev(durations), "FAIL" if failure else "")
예제 #3
0
 def eventReceived(self, event):
     self._times.append(event['duration'])
     if len(self._times) == 200:
         print('mean:', mean(self._times))
         print('median:', median(self._times))
         print('stddev:', stddev(self._times))
         print('mad:', mad(self._times))
         del self._times[:100]
예제 #4
0
 def eventReceived(self, event):
     self._times.append(event['duration'])
     if len(self._times) == 200:
         print('mean:', mean(self._times))
         print('median:', median(self._times))
         print('stddev:', stddev(self._times))
         print('mad:', mad(self._times))
         del self._times[:100]
예제 #5
0
    def failures(self):
        reasons = []

        for operation, lags in self._perOperationLags.iteritems():
            if median(lags) > self._lag_cut_off:
                reasons.append(self._LATENCY_REASON % dict(
                    operation=operation.upper(), cutoff=self._lag_cut_off * 1000))

        for operation, times in self._perOperationTimes.iteritems():
            failures = len([success for (success, _ignore_duration) in times if not success])
            if failures * 100.0 / len(times) > self._fail_cut_off:
                reasons.append(self._FAILED_REASON % dict(
                    operation=operation.upper(), cutoff=self._fail_cut_off))

        return reasons
예제 #6
0
    def failures(self):
        reasons = []

        for operation, lags in self._perOperationLags.iteritems():
            if median(lags) > self._lag_cut_off:
                reasons.append(self._LATENCY_REASON %
                               dict(operation=operation.upper(),
                                    cutoff=self._lag_cut_off * 1000))

        for operation, times in self._perOperationTimes.iteritems():
            failures = len([
                success for (success, _ignore_duration) in times if not success
            ])
            if failures * 100.0 / len(times) > self._fail_cut_off:
                reasons.append(self._FAILED_REASON % dict(
                    operation=operation.upper(), cutoff=self._fail_cut_off))

        return reasons
예제 #7
0
    def failures(self):
        reasons = []

        for operation, lags in self._perOperationLags.iteritems():
            if median(lags) > self._lag_cut_off:
                reasons.append(self._LATENCY_REASON %
                               dict(operation=operation.upper(),
                                    cutoff=self._lag_cut_off * 1000))

        for operation, times in self._perOperationTimes.iteritems():
            failures = len([
                success for (success, _ignore_duration) in times if not success
            ])
            if failures * 100.0 / len(times) > self._fail_cut_off:
                reasons.append(self._FAILED_REASON % dict(
                    operation=operation.upper(), cutoff=self._fail_cut_off))

        for operation, times in self._perOperationTimes.iteritems():
            overDurations = [0] * len(self._thresholds)
            for success, duration in times:
                for ctr, item in enumerate(self._thresholds):
                    threshold, _ignore_fail_at = item
                    if duration > threshold:
                        overDurations[ctr] += 1
            checks = []
            for ctr, item in enumerate(self._thresholds):
                threshold, fail_at = item
                fail_at = fail_at.get(operation, fail_at["default"])
                checks.append(
                    (overDurations[ctr], fail_at,
                     self._REASON_1 + self._REASON_2 % (threshold, )))
            for count, cutoff, reason in checks:
                if count * 100.0 / len(times) > cutoff:
                    reasons.append(
                        reason % dict(method=operation.upper(), cutoff=cutoff))

        if self._fail_if_no_push and "push" not in self._perOperationTimes:
            reasons.append(self._PUSH_MISSING_REASON)

        return reasons