| 1 |
Logging to Sentry |
| 2 |
================= |
| 3 |
|
| 4 |
According to the `official website <https://www.getsentry.com/about/>`_... |
| 5 |
|
| 6 |
Sentry is an event logging platform primarily focused on capturing and |
| 7 |
aggregating exceptions. |
| 8 |
|
| 9 |
It was originally conceived at DISQUS in early 2010 to solve exception |
| 10 |
logging within a Django application. Since then it has grown to support |
| 11 |
many popular languages and platforms, including Python, PHP, Java, Ruby, |
| 12 |
Node.js, and even JavaScript. |
| 13 |
|
| 14 |
Come again? Just what is Sentry, exactly? |
| 15 |
----------------------------------------- |
| 16 |
|
| 17 |
The `official documentation <https://docs.sentry.io/platforms/python/>`_ |
| 18 |
explains it better: |
| 19 |
|
| 20 |
Sentry is a realtime event logging and aggregation platform. At its core it |
| 21 |
specializes in monitoring errors and extracting all the information needed |
| 22 |
to do a proper post-mortem without any of the hassle of the standard user |
| 23 |
feedback loop. |
| 24 |
|
| 25 |
If that sounds like something you'd want to gift your precious Errbot instance with, |
| 26 |
then do keep on reading :) |
| 27 |
|
| 28 |
Setting up Sentry itself |
| 29 |
------------------------ |
| 30 |
|
| 31 |
Installing and configuring sentry is beyond the scope of this document. However, |
| 32 |
there are two options available to you. You can either get a |
| 33 |
`hosted account <https://sentry.io/pricing>`_, or grab the code and |
| 34 |
`run your own server <https://develop.sentry.dev/self-hosted/>`_ instead. |
| 35 |
|
| 36 |
Configuring Errbot to use Sentry |
| 37 |
-------------------------------- |
| 38 |
|
| 39 |
Once you have an instance of Sentry available, you'll probably want to create a |
| 40 |
team specifically for Errbot first. |
| 41 |
|
| 42 |
When you have, you should be able to access a page called "Client configuration". |
| 43 |
There, you will be presented with a so-called DSN value, which has the following format: |
| 44 |
|
| 45 |
http://0000000000000000:[email protected]/0 |
| 46 |
|
| 47 |
To setup Errbot with Sentry: |
| 48 |
|
| 49 |
* Open up your bot's config.py |
| 50 |
* Set **BOT_LOG_SENTRY** to *True* and fill in **SENTRY_DSN** with the DSN value obtained previously |
| 51 |
* Optionally adjust **SENTRY_LOGLEVEL** to the desired level |
| 52 |
* Optionally adjust **SENTRY_OPTIONS** to customise the rest of the initialization. |
| 53 |
* Restart Errbot |
| 54 |
|
| 55 |
You can find a list of `Sentry options <https://docs.sentry.io/platforms/python/configuration/options/>`_. |
| 56 |
|
| 57 |
You should now see Exceptions and log messages show up in your Sentry stream. |