[ckan-dev] Using sentry with ckan

David Raznick david.raznick at okfn.org
Mon Feb 17 18:32:25 UTC 2014


On 17 February 2014 14:40, Samuele Santi <samuele.santi at trentorise.eu> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 02/17/2014 02:46 PM, David Raznick wrote:
>> Hello
>>
>> Yes I have got sentry working with CKAN.  If you are running ckan
>> under apache with a wsgi file like:
>> https://github.com/ckan/ckan-packaging/blob/master/etc/ckan/default/apache.wsgi
>
>>
>>
> [...]
>
>> You also have to set the ckan config file to have
>>
>> full_stack = false
>>
>> This will stop the pylons error middlewhere catching these errors
>> and therefore all errors will get to sentry.
>>
>> IMiddlewhere would work but it would not catch all possible errors
>> as its too close to the centre of the middlewhere stack.  i.e if
>> repoze.who for example went wrong it would not catch it.   The
>> above approach means that it catches everything as it is the
>> outermost app.
>
> Cool, I just wrote this
> https://github.com/opendatatrentino/ckanext-sentry but your approach
> seems to be definitely better..

Looks great.  It may be worth adding another middlewhere extension
point in CKAN core that works on the outer app instead near the inner
one, to make this extension work well without needing to modify the
wsgi file.

>
> I propose adding this to Ckan documentation, as it might be of
> interest of others..
>
> btw, I'd load sentry DSN from the configuration instead of sticking it
> in the wsgi

I intended to do that at some point too.

>
>
> Another question: did you configure logging too?

No did not look at this as was not what we wanted.

> I found out that something like this
> https://github.com/opendatatrentino/ckanext-sentry/blob/master/ckanext/sentry/plugin.py#L41
> works when put in the IMiddleware, but apparently didn't work when put
> in the .wsgi file.. that's kinda weird, but I'm going to investigate
> further.

It could be that if you put your import statements in the wrong place
in imports the wrong version (i.e the one not inside the virualenv).
Apart from that I cannot think why it should make any difference where
you configure logging.


>
>
> BTW, I'm also going to see if I can adapt this to work with gunicorn
> too, in order to make it work in my development environment too..
>

That would be great too.  We are looking to using sentry ourselves for
our deployments so it would be good to collaborate on this.

>
> Thanks
>
>
> - --
> Samuele Santi
>
> Trento Rise
> http://www.trentorise.eu/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBAgAGBQJTAh9iAAoJEGgM+6dff2m7jggQALRUB+hWxqEfCBOcBr+a6Rbu
> paGahKHxMx4cRfL6RsQiC9/huMnKOJTnkaSwJItzpQjXlGLDr8LysIIvjF+sbOoY
> H7pzFYb64jSX5wEqHs1dJ6y/ek4Lci7Z9vgZA61522BbEFv4xlxHu+Si/C0Z6n9r
> ps8GYYXFzptycLq9gXLZGvIg4YuZqVCToRbMJDl8pvAHvQcBSoraLHP2LNakQymx
> sYgwxXv5vo11S+RiRAwrziVzpjNhnSGDygWk4nX50i2F9BNhpZj9Yg97yaWhA6w9
> mXiIRp6XlLL9UBg+w40uVfigkQY2s7BjfUARMuyhqiLBow3jLfp1ZS8Qx7P/9XbO
> ZOIaOycyXXQAjal+aHJdduAeebWVAIv5KdrYuZz3a6HbQHs9l0vjFAZModX8+Uw1
> 75DGSp9F5XtObPIkXsen4jEC+0LUpU5W+tYmYPofcyjjiixNhBtZZ5wQEv7ld9yp
> mTZawcRSgoMWzIV/sG2/di3yRgV/X8wHtjGCLOseimf7x6Nv3IzqI4Bl2JNxWpTw
> uIfe/kuHw3DLQbff5rtFfH6iqlBtBag7nlkII8zwauxUyjL1WvQz4CqNG/7ue2cn
> l+xIeU2XXa8QfY9feTDt7aYqy++S0o8xlgopz20DAsxpdfX1vMOvXxQ0zXrCZak9
> GPXOXMjxF1SmuAUfNFXU
> =hXlr
> -----END PGP SIGNATURE-----
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev



More information about the ckan-dev mailing list