etsy/skyline — pull request #110 by earthgecko (2014-12-21 16:54:46+00:00)
Title: wildcard_alert_patterns

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': 'me@me.com',
'stats.publishers.bob.rpm': 'me@me.com',
```

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': 'me@me.com',
```

This allows much more granular and configurable alerting

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

'stats.publishers.[a-m].rpm': 'charlie@me.com',
'stats.publishers.[n-z].rpm': 'danny@me.com',
```

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