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

Commit

Permalink
Added standard Datadog tag type:change to simplify filtering when the…
Browse files Browse the repository at this point in the history
…re's many sources of changes (terraform, ..)
  • Loading branch information
Mikael Johansson committed Aug 31, 2016
1 parent 6e1e45f commit fe9e0a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lighter/datadog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Datadog(object):
def __init__(self, token, tags=[]):
self._token = token
self._url = 'https://app.datadoghq.com'
self._tags = tags + ['source:lighter']
self._tags = tags + ['source:lighter', 'type:change']

def notify(self, title, message, id, tags=[], priority='normal', alert_type='success'):
if not title or not message or not id:
Expand Down
9 changes: 6 additions & 3 deletions src/lighter/test/datadog_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def testDefaultTags(self):
expected = [
'environment:default',
u'service:/myproduct/myservice',
'source:lighter']
'source:lighter',
'type:change']
self.assertEquals(expected, mock_jsonRequest.call_args[1]['data']['tags'])

def testConfiguredTags(self):
Expand All @@ -79,7 +80,8 @@ def testConfiguredTags(self):
'somekey:someval',
'anotherkey:anotherval',
'justakey',
'source:lighter']
'source:lighter',
'type:change']
self.assertEquals(expected, mock_jsonRequest.call_args[1]['data']['tags'])

def testDeploymentMetric(self):
Expand All @@ -93,7 +95,8 @@ def testDeploymentMetric(self):
'somekey:someval',
'anotherkey:anotherval',
'justakey',
'source:lighter']
'source:lighter',
'type:change']
data = mock_jsonRequest.call_args_list[-2][1]['data']['series'][0]
self.assertEquals('lighter.deployments', data['metric'])
self.assertEquals(1, data['points'][0][1])
Expand Down

0 comments on commit fe9e0a2

Please sign in to comment.