[ckan-dev] Using sentry with ckan

Samuele Santi samuele.santi at trentorise.eu
Tue Feb 18 11:32:01 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/17/2014 07:32 PM, David Raznick wrote:
> 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.

Yes, it's pretty handy to be able to just install a plugin, but as you
pointed out, the IMiddleware insertion point is not optimal for this case.


> I propose adding this to Ckan documentation, as it might be of 
> interest of others..

I drafted something here:

https://github.com/opendatatrentino/ckanext-sentry/tree/master/alternatives

(I'm successfully running it with gunicorn, btw)


> 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.

from pylons import config
sentry_dsn = config.get('sentry.dsn')

:)


> Another question: did you configure logging too?
> 
>> No did not look at this as was not what we wanted.

It's nice, as it allows to capture other things, such as warnings and
caught exceptions (proven that logger.exception() is called in the
except:)


> 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.

yeah, it could be, I hate that execfile() hack to enable the
virtualenv, but I suspect there is no way to make mod_wsgi use a
different interpreter on a per-virtualhost level (that's why I usually
use gunicorn :))


> 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.

https://github.com/opendatatrentino/ckanext-sentry/tree/master/alternatives#with-gunicorn

\m/


Cheers

- -- 
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/

iQIcBAEBAgAGBQJTA0SxAAoJEGgM+6dff2m7F9MP/0kk/0cpSiJp5PF+Nn5jUxmi
5aKj8mgl5ESbXey64X1YOY/sjVBrQ9yU8YEgX3UH/2CPEmkscqgmNFZxAGX1WDuy
08P5/R9lz2HIzE3DAatZ1VP+9uB9kfqWybNrrwmG3Cy+bfBLPtlZPFnwF8cJ/85n
cVIv/pOmQAVxZhAaDoEOO/gNioPbJQI4L4KEZdbR492FH0zznRW9ZT17TaBJaNKC
dB0gAERCmchEMbHaiDuLQ+yI0U5tvnHSAaByTTSiJGRloq4nWFyucrejnv5a3H8d
EXheh5gKwFYMiMx/rBuFRSlexGfXAnBwKudf2EO/Unhgiw6g+X1+uG8nTUxhjit1
5vYUmeXgKZC7WrtCeVVpZuzTS1KFqZfm0BU1D3+H9ZQ4roX70IcVtNaFg5UAPznG
kGa6H1zF+V3lipEqDH+ZrN+8uXSNhtSCQHz1e0oRwa1ykC8eAIhmEvCrNcstYWky
NEN9PEesJV4x7kwfd2m43YhpmW1e3dbuVBuGzAZPxv1tyPaQMl330earKDJbWXr2
roZPAY658AkH7rrAWmIQ7eoz7wcWnDb3WpgJ2+xi82Nquvcy2znlHkcF8sAv2jG1
FoQeb07scD3JhymKDKfrTC+FoiY+gJc4lCYZD2AwH7Nnkmy1qAQyXVFgw+Zd0a0G
mgpnLlhSCYteO/q23pa+
=/1bt
-----END PGP SIGNATURE-----



More information about the ckan-dev mailing list