-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from sprockets/improve-sentry
Log more information to sentry
- Loading branch information
Showing
11 changed files
with
255 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import sys | ||
import signal | ||
|
||
from tornado import ioloop, web | ||
|
||
from sprockets.mixins import sentry | ||
|
||
|
||
class Handler(sentry.SentryMixin, web.RequestHandler): | ||
|
||
def initialize(self, **kwargs): | ||
tags = kwargs.pop('tags', dict()) | ||
super(Handler, self).initialize(**kwargs) | ||
self.sentry_tags.update(tags) | ||
|
||
def get(self, status_code): | ||
self.set_status(int(status_code)) | ||
|
||
|
||
def stop(signo, frame): | ||
iol = ioloop.IOLoop.current() | ||
iol.add_callback_from_signal(iol.stop) | ||
|
||
|
||
if __name__ == '__main__': | ||
tags = {} | ||
for arg in sys.argv[1:]: | ||
name, _, value = arg.partition('=') | ||
tags[name] = value | ||
|
||
signal.signal(signal.SIGINT, stop) | ||
app = web.Application([web.url(r'/(\S+)', Handler, {'tags': tags})]) | ||
app.listen(8000) | ||
ioloop.IOLoop.current().start() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.