I tried to send reports to sentry from my nameko-app with nameko-sentry and It wasn’t succesful. I tried Python3.8.1 and Python3.6.9 with the same result. I generated DSN on my sentry.io account and put it into config.yaml. After this I just copied official example code from nameko-sentry git repository and run it:
# service.py
from nameko.web.handlers import http
from nameko_sentry import SentryReporter
class Service(object):
name = "demo"
sentry = SentryReporter()
@http("GET", "/broken")
def broken(self, request):
raise SomeException("boom")
I can’t see any result in sentry.io after raising SomeExcepton(‘boom’) or simple Exception(‘boom’).
But when I using sentry_sdk.capture_exception directly with the same DSN I can see new reports in sentry.io. What I’m doing wrong with nameko-sentry?
It was me who started the mentioned Github issue and I apologize for not moving forward. I couldn’t get the tests to deterministically pass or fail and they don’t run on Travis CI (there’s a PR that fixes that part).
However, this is curious. We’re using nameko_sentry in production and it still works for us. For example:
from nameko.rpc import rpc
from nameko.web.handlers import http
from nameko_sentry import SentryReporter
class Service:
name = "crasher_service"
sentry = SentryReporter()
@rpc
def crash(self):
raise Exception("oops, I crashed")
@http("GET", "/")
def crash_http(self, request):
raise Exception("http crashed")
Both RPC and HTTP exceptions get logged to our Sentry instance. This is under Python 3.6.6 with the following dependencies:
When I tried to run the same service under Python 3.8.1 with the same dependencies, indeed no exceptions were logged to Sentry. There’s still an unsolved eventlet issue with outgoing HTTPS requests on Python 3.7+, so perhaps that’s what happens somewhere within raven.
However this is no excuse not to switch from raven to sentry-sdk and I guess we should double down on that.
Ah, now you’ve reminded me about that eventlet issue, I remember downgrading to Py3.6 on a previous project to fix sentry reporting.
A curious workaround has since been discovered for that eventlet issue – installing PyOpenSSL version 19.1.0. This fixes eventlet, but I have not tested whether it solves this problem yet.
In any case, as you say, not an excuse not to switch from raven to sentry-sdk.
[Slightly OT] And yet that workaround doesn’t work in every case. I’ve had some small nameko services run just fine on Python 3.8, including posting to https:// URLs (with PyOpenSSL installed), while others crashed. However, this commit seems to fix the eventlet issue entirely (fingers crossed).
Update: I can confirm that installing eventlet from that commit seems to fix reporting to Sentry on Python 3.8 (in my crasher_service example).