Skip to content

Commit

Permalink
add extra tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jneves committed Feb 25, 2018
1 parent 12f2eb7 commit f65a187
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions zappa_sentry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@ def unhandled_exceptions(e, event, context):
# not deployed, probably a test
pass

print(event)
print(context)
if 'httpMethod' in event:
extra_tags = {
'http_method': event['httpMethod'],
'path': event['path']
}
if 'Host' in event['headers']:
extra_tags['host'] = event['headers']['Host']
if 'User-Agent' in event['headers']:
extra_tags['user_agent'] = event['headers']['User-Agent']
if 'requestContext' in event and 'stage' in event['requestContext']:
extra_tags['stage'] = event['requestContext']['stage']
raven_client.context.merge({'tags': extra_tags})

raven_client.context.merge({'extra': {
'event': event,
'context': context
'event': event
}})

raven_client.captureException()
Expand Down

0 comments on commit f65a187

Please sign in to comment.