Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

wildcard_alert_patterns #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

earthgecko
Copy link

Added the ability to match wildcard metric patterns in the analyzer.py alert context.

Currently the alert matching is a one to one relationship - metric -> alert setting.

Therefore it is not possible to map wildcarded metrics to a single ALERT and strategy settings e.g.

metrics namespaces:
stats.publishers.alice.rpm
stats.publishers.bob.rpm

Currently we would have to define an individual ALERT for each metric

            ('stats.publishers.alice.rpm', 'smtp', 300),
            ('stats.publishers.bob.rpm', 'smtp', 300),

and an individual strategy for each whether in the SMTP_OPTS or otherwise

        'stats.publishers.alice.rpm': '[email protected]',
        'stats.publishers.bob.rpm': '[email protected]',

This change to using python re and not if alert[0] in metric[1] allows for both the current functionality, but it extends the alerting to allow wildcarded namespaces to one alert setting

            ('stats.publishers.*.rpm', 'smtp', 300),
        'stats.publishers.*.rpm': '[email protected]',

This allows much more granular and configurable alerting

            ('stats.publishers.*.rpm', 'smtp', 300),

# this would probably require another pull request
        'stats.publishers.[a-m].rpm': '[email protected]',
        'stats.publishers.[n-z].rpm': '[email protected]',

This does not break any functionality and fits with the current cache_key = 'last_alert.%s.%s' % (alert[1], metric[1])

Added the ability to match wildcard metric patterns in the analyzer.py alert
context.
Modified:
readme.md
src/settings.py.example
src/analyzer/analyzer.py
@earthgecko
Copy link
Author

Further there is no discernible impact on CPU use / load average changing the in to the regular expression match, however the skyline analyzer run_time has increased by 8 seconds from 58 seconds to 66 seconds. I worried that it may be heavier on CPU but is heavier on run_time.

This is based on running against 11890 metrics.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant