diff --git a/CHANGELOG.md b/CHANGELOG.md index 909e89d..8a6b41d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.10.1 (2023-7-24) + +* Added `auto_resolve_after` parameter in `Detect` class. + ## 2.10.0 (2023-7-19) * Added `AmazonEventBridgeNotification` for Amazon EventBridge integration within detectors. diff --git a/setup.cfg b/setup.cfg index cddec03..3180ae8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.10.0 +current_version = 2.10.1 commit = True tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\.(?P[a-z]+)(?P\d+))? diff --git a/setup.py b/setup.py index 2307d8a..60ef867 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ setup( name='signal_analog', - version='2.10.0', + version='2.10.1', description='A troposphere-like library for managing SignalFx' + 'Charts, Dashboards, and Detectors.', long_description=readme + '\n\n' + history, diff --git a/signal_analog/__init__.py b/signal_analog/__init__.py index 9f73602..707d252 100644 --- a/signal_analog/__init__.py +++ b/signal_analog/__init__.py @@ -9,7 +9,7 @@ __author__ = """Fernando Freire""" __email__ = 'Lst-nike.plus.platform.sharedinfrastructure@nike.com' -__version__ = '2.10.0' +__version__ = '2.10.1' logging_config = pkg_resources.resource_string( __name__, 'logging.yaml').decode('utf-8') diff --git a/signal_analog/flow.py b/signal_analog/flow.py index cfefa16..eaee57e 100644 --- a/signal_analog/flow.py +++ b/signal_analog/flow.py @@ -992,8 +992,8 @@ def __init__(self): class Detect(Function): - def __init__(self, on, off=None, mode=None): - """Creates a object. + def __init__(self, on, off=None, mode=None, auto_resolve_after=None): + """Creates an object. A 'detect' object is used to create events when a condition is met and when it clears. These events can be used to notify people of when @@ -1003,18 +1003,22 @@ def __init__(self, on, off=None, mode=None): Arguments: on: Data when expression that will fire an event with the status "anomalous". off: Data when expression that will fire an event with the status "ok". If not specified then the 'off' is - equivalent to not on + equivalent to not on mode: String mode of the detector - paired - both on and off conditions are always evaluated simultaneously. The alert is raised if on - is true and off is false, and the alert is cleared if the off is true and on is false. + paired: both on and off conditions are always evaluated simultaneously. The alert is raised if on + is true and off is false, and the alert is cleared if the off is true and on is false. - split - the on condition is evaluated only if there is no alert, and the alert is raised when the - on condition evaluates to true. The off condition is only evaluated when the alert is raised, and - the alert is cleared when the off condition evaluates to true. + split: the on condition is evaluated only if there is no alert, and the alert is raised when the + on condition evaluates to true. The off condition is only evaluated when the alert is raised, and + the alert is cleared when the off condition evaluates to true. + auto_resolve_after: After any input data stream stops receiving data points for the specified duration, + the detector clears active alerts. """ super(Detect, self).__init__("detect") - self.args = [Arg(on), KWArg("off", off), KWArg("mode", mode)] + self.args = [Arg(on), + KWArg("off", off), KWArg("mode", mode), + KWArg("auto_resolve_after", auto_resolve_after)] class Op(Function): diff --git a/tests/generators.py b/tests/generators.py index b7647a6..0a42415 100644 --- a/tests/generators.py +++ b/tests/generators.py @@ -78,7 +78,8 @@ def detects(draw): on = draw(flows()) off = draw(ascii()) mode = draw(sampled_from(["paired", "split"])) - return flow.Detect(on, off=off, mode=mode) + auto_resolve_after = draw(ascii()) + return flow.Detect(on, off=off, mode=mode, auto_resolve_after=auto_resolve_after) @composite