I'm using Sentry with Pyramid, as per their official .ini config notes:
https://docs.getsentry.com/hosted/clients/python/integrations/pyramid/

This way, if there is ever an Internal Server Error page, I get a full 
stack-trace submitted to Sentry as well as a request which can be replayed 
or converted to curl command line. Super life-saver when trying to debug 
hard-to-reproduce bugs.

My problem is that obviously I don't want the user to see an Internal 
Server Error page, so I put all critical functions in try-except blocks.

When using a try-except block Sentry has a captureException method, which 
submits that stack-trace to Sentry.
https://docs.getsentry.com/hosted/clients/python/usage/

My problem is that when using this captureException, the request parameters 
are not submitted, only the stack-trace, so the exception cannot be 
replayed / curl-ed this way.

David Cramer from Sentry replied to me that if Sentry is used with the 
middleware, then it should automatically receive the WSGI context:
from sentry.middleware import Sentry

application = Sentry(application, client=Client(dsn, ...))

My problem is that in Pyramid I have no idea where could I get an 
application, or if this would work at all.

There is a pyramid-raven library, which I believe does what I'd need to 
attach the http context, but it's not using an application but a manually 
created http data dict.
https://github.com/thruflo/pyramid_raven/blob/bb4bb5227b9c40efec71238b4ee452db01921d45/src/pyramid_raven/client.py#L103

What is the recommended way to Pyramid to get this context? Are any of you 
using Sentry with a wrapper for captureException?  

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to