Web2py Integration with Sentry

163 views
Skip to first unread message

James Q

unread,
Jan 6, 2014, 10:14:46 PM1/6/14
to web...@googlegroups.com
Has anyone ever integrated web2py an Sentry (https://github.com/getsentry/sentry)? I would like it if all web2py generated exceptions generate a ticket like usual, but also generates an event to a sentry server. Has anyone ever done this? If not, could anyone point to where I would need to patch web2py or how best this integration would work?

Thanks for any help!

Derek

unread,
Jan 7, 2014, 8:24:14 PM1/7/14
to web...@googlegroups.com
I haven't, but I've done something similar with a different piece of software. You'd usually just use it as a wsgi middleware around your app. So you'd need to run web2py as wsgi and wrap it with Sentry.

James Q

unread,
Jan 9, 2014, 12:27:46 AM1/9/14
to web...@googlegroups.com
Interesting. I have never written wsgi middleware, any pointers on that? As middleware, I would still need to have an understanding of how to detect if an exception has been logged in the request, no?

Thanks!

-- J

Massimo Di Pierro

unread,
Jan 9, 2014, 9:16:02 AM1/9/14
to web...@googlegroups.com
The problem is that it would not work. you can have exceptions at two levels: web2py apps, web2py itself. In other frameworks these two levels are mixed up so sentry will catch either exceptions. In web2py the two levels are well separated and web2py catches app exceptions before they propagate up and sentry would not catch them. sentry would only catch exceptions in web2py itself and that is pretty much useless. 

You can think about it in another way, web2py already has a mechanism to catch exceptions and log them. and you cannot do:

try:
    try:
      do something
   exceptiion: 
      web2py ticket system
except:
   sentry logging system

and expect the second except to catch anything. Look instead into scritps/tickets2db.py and scripts/tickets2email.py and modify them to do what you need to do.

James Q

unread,
Jan 15, 2014, 1:41:54 AM1/15/14
to web...@googlegroups.com
Massimo: Would you consider taking a patch / pull request for a new script?

-- James

Massimo Di Pierro

unread,
Jan 15, 2014, 12:17:12 PM1/15/14
to web...@googlegroups.com
Always. :-)

Rules are simple. I always take a patch if:
1) fixes a security issue OR
2) does not break backward compatibility AND
3) makes web2py faster OR
4) add a new functionality without making previous behavior slower

James Q

unread,
Jan 16, 2014, 1:00:13 PM1/16/14
to web...@googlegroups.com

Great. I won't be able to get to this soon, but I assume the standard process: git clone, make change and make a pull request?

-- james

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/cYXGl7rlvKQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Stefan van den Eertwegh

unread,
Jan 20, 2016, 8:05:10 AM1/20/16
to web2py-users
James, Massimo, is there any news over a possible patch for sentry with web2py i.e. WSGI middleware?


Op donderdag 16 januari 2014 19:00:13 UTC+1 schreef James Q:

James Q

unread,
Jan 20, 2016, 9:01:21 AM1/20/16
to web2py-users
Sorry, I ended up not using web2py so I never got to this :(
Reply all
Reply to author
Forward
0 new messages