arachnys / cabot

Self-hosted, easily-deployable monitoring and alerts service - like a lightweight PagerDuty
MIT License
5.59k stars 594 forks source link

if head of the [0- debounce] checks is all faild, debounce args lose efficacy #585

Open dengshaochun opened 6 years ago

dengshaochun commented 6 years ago

when i set up a new check, and set debounce = 5 , if the first check is faild , there will be alarms。

looks like:

"""
case when:
len(recent_results) = 1 and recent_results[0].succeeded = 0

exec result:
return False
"""

def calculate_debounced_passing(recent_results, debounce=0):
    """
    `debounce` is the number of previous failures we need (not including this)
    to mark a search as passing or failing
    Returns:
      True if passing given debounce factor
      False if failing
    """
    if not recent_results:
        return True
    debounce_window = recent_results[:debounce + 1]
    for r in debounce_window:
        if r.succeeded:
            return True
    return False
codecov[bot] commented 6 years ago

Codecov Report

Merging #585 into master will increase coverage by 0.06%. The diff coverage is 82.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #585      +/-   ##
==========================================
+ Coverage   80.89%   80.95%   +0.06%     
==========================================
  Files          46       45       -1     
  Lines        2952     2920      -32     
  Branches      179      178       -1     
==========================================
- Hits         2388     2364      -24     
+ Misses        505      497       -8     
  Partials       59       59
Impacted Files Coverage Δ
cabot/cabotapp/views.py 71.19% <ø> (+0.3%) :arrow_up:
cabot/cabotapp/jenkins.py 97.14% <100%> (ø) :arrow_up:
cabot/cabotapp/models/base.py 79.22% <71.42%> (-0.3%) :arrow_down:
cabot/cabotapp/models/jenkins_check_plugin.py 66.66% <83.33%> (+1.14%) :arrow_up:
cabot/urls.py 82.5% <0%> (-0.84%) :arrow_down:
cabot/templates/base.html 94.59% <0%> (-0.28%) :arrow_down:
cabot/settings.py 68.42% <0%> (ø) :arrow_up:
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4e4ca0a...8cedc16. Read the comment docs.