New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
document ignore_errors #149
Comments
There is a |
Could you please link to the documentation for this feature? I have been finding the updated documentation for the new library frustratingly scant in its cross linkings, and laking in details that the older, mature raven library's documentation did contain. |
@biblicabeebli we will add this. I'll keep this issue open as reminder |
@biblicabeebli FWIW we decided not to stabilize Concretely we eventually want to use the same syntax for |
I understand the urge to centralize an inherently scattered feature - integration with every framework/library requires a custom blob of code to extract the configuration correctly - but I strongly disagree with what sounds like a decision to drop probably the most basic necessary feature beyond "does it work" in an error reporting/monitoring framework. Asking someone to write their own code to handle this particular issue is silly. This is an error reporting platform. The literal first thing we encountered was "oh, error X is garbage and for Capital-R Reasons we can't disable or squash it, but we don't want that particular one spamming us, how do I disable it..." This cannot possibly be an edge case. The above should be sufficient reason to stabilize the feature, but if its not... This is an error reporting and monitoring framework. If I can't block a thing at its source - because sometimes its just not possible to block a thing in the Sentry website's UI because it varies just slightly too much - then cannot use the service to monitor my servers. Too many false negatives. I'm going elsewhere. |
There is no decision yet. Stabilizing In any case we should come up with something that works the same across SDKs. Meanwhile you can do the same thing with import sentry_sdk
def before_send(event, hint):
if 'exc_info' in hint:
exc_type, exc_value, tb = hint['exc_info']
if isinstance(exc_value, (IgnoredErrorFoo, IgnoredErrorBar)):
return None
return event
sentry_sdk.init(before_send=before_send)
I mean, generally this seems like an issue on its own: That sentry is generating multiple issues for a thing you consider to be a single issue. Just mentioning this for completeness, since it generally seems to be an underused feature: If that's the only reason why you can't send those events in the first place, consider setting a custom fingerprint for that error class (using Sure, if you'd be over quota with those events then it's not an option and you need to block the data before. |
Just arrived here since I was looking for this feature. |
In agreement with @biblicabeebli . This is the first thing I want to configure after getting Sentry set up. Thanks for the work-around with Just my two cents: implementing something roughly equivalent to the old |
"Stabilizing ignore_errors is in our internal backlog, but we don't know how important it is to people. In that sense, thanks for your feedback." It's very important, imo. As others have said, please prioritize this implementation! We are using the |
If I may put my two cents in, I'd say that |
I used the workaround of before_send provided in my Flask app. But it didn't work for me as I did not get 'exc_info' in the hint. Here is event variable data:
Please help! |
@mrtarunjain this event is not an exception. It likely contains a logger name. Your best bet is to filter out that logger. I think you want https://docs.sentry.io/platforms/python/logging/#ignoring-a-logger |
Sorry for the tangent but this came up in a Google search
It's not in the documentation, but to get the same effect as ignore_errors, instead of sentry-python/sentry_sdk/client.py Lines 152 to 155 in d25fba8
|
so much this. The ability to disable exception reporting on |
Is there any working example of how to ignore a single error? The old SDK implemented this very basic functionality just fine, I don't get why it got dropped, I feel the new SDK is a huge step back compared to the previous one (since it just dropped functionality but didn't add anything new). The documentation says: import sentry_sdk
def strip_sensitive_data(event, hint):
# modify event here
return event
sentry_sdk.init(
before_send=strip_sensitive_data
) However, the "modify event here" code is unknown, and we're left to guess it. The There's another example in the docs which just won't work because it references entries that the
{'log_record': <LogRecord: py.warnings, 30, /usr/local/lib/python3.8/warnings.py, 109, "%s">} Also, this doesn't have the >>> hint['log_record'].exc_info == None
True Meanwhile, the Can we have a working example of how to ignore a single type of event based on the exception/warning class? |
@WhyNotHugo This issue is about ignoring exception classes while you seem to want to ignore a warning class. To my knowledge the Raven SDK did not provide any simple configuration option to ignore warnings by class. It doesn't really help that Django has logger names such as DisallowedHost that look like exception classpaths, but this is nothing new and has little to do with Sentry. I am really curious as to what's going on here, as it seems that you have configured the SDK to send each warning log as event to Sentry, possibly using the API documented as part of the logging integration. That seems generally excessive and is certainly not the default of the SDK. I would encourage you to open a new issue about this as the idea of ignoring a warning class is very different from what we're discussing here and there seems to be more going on here than what fits into either feature request. |
Also feel free to hop onto the Discord linked in the README as you've opened a couple of issues in the SDK that indicate you're having a especially bad time migrating. I would be curious as to how your Raven configuration looked and what kind of errors you were used to get. |
Aren't warning/errors handled pretty much the same? I am indeed logging warnings, since I generally want to be aware of any that might occur on production. init_sentry(
attach_stacktrace=True,
before_send=before_send,
integrations=[
CeleryIntegration(),
DjangoIntegration(),
LoggingIntegration(event_level=logging.WARNING),
],
release=version,
in_app_exclude=["logging"],
) So |
The two questions "error vs warning" and "exc_info vs not" are completely orthogonal: # Sentry error event without stacktrace or exception
# "exc_info" not in hint
# hint["log_record"].exc_info is None
logging.error("random error logged, but no exception")
try:
1/0
except:
# Sentry "warning" event with an exception and stacktrace attached
# hint["log_record"].exc_info is not None
# hint["log_record"].exc_info is hint["exc_info"]
logging.warning("failed to divide by zero", exc_info=True) This data model is part of the logging library and, for lack of a better word, not Sentry's fault. By default only the error is sent as event, and we make that decision purely based on the event_level. Full acknowledgement that hints are poorly documented. EDIT: Not sure, but this page does link to https://docs.sentry.io/platforms/python/#hints |
Oh, many of my warnings are actually However, since they're third part libs (or even stdlib), I can't jump in and add |
Okay we don't regard that as exception though. I think this would be a good addition though, to be able to filter by warning class |
SystemExit is raised by `sys.exit`; in that sense, it is never "uncaught" because we chose to cause it explicitly. For instance, Tornado responds to SIGTERM by calling `sys.exit(1)`, which does not merit being logged to Sentry. Use the suggested form[1] for ignoring classes of error. [1] getsentry/sentry-python#149 (comment)
There are three exceptions in Python3 which are descended from BaseException, but not Exception: GeneratorExit, KeyboardInterrupt, and SystemExit. None of these are suitable to be sent to Sentry. For example, SystemExit is raised by `sys.exit`; in that sense, it is never "uncaught" because we chose to cause it explicitly. Use the suggested form[1] for ignoring specific classes of exceptions. [1] getsentry/sentry-python#149 (comment)
There are three exceptions in Python3 which are descended from BaseException, but not Exception: GeneratorExit, KeyboardInterrupt, and SystemExit. None of these are suitable to be sent to Sentry. For example, SystemExit is raised by `sys.exit`; in that sense, it is never "uncaught" because we chose to cause it explicitly. Use the suggested form[1] for ignoring specific classes of exceptions. [1] getsentry/sentry-python#149 (comment)
There are three exceptions in Python3 which are descended from BaseException, but not Exception: GeneratorExit, KeyboardInterrupt, and SystemExit. None of these are suitable to be sent to Sentry. For example, SystemExit is raised by `sys.exit`; in that sense, it is never "uncaught" because we chose to cause it explicitly. Use the suggested form[1] for ignoring specific classes of exceptions. [1] getsentry/sentry-python#149 (comment)
There are three exceptions in Python3 which are descended from BaseException, but not Exception: GeneratorExit, KeyboardInterrupt, and SystemExit. None of these are suitable to be sent to Sentry. For example, SystemExit is raised by `sys.exit`; in that sense, it is never "uncaught" because we chose to cause it explicitly. Use the suggested form[1] for ignoring specific classes of exceptions. [1] getsentry/sentry-python#149 (comment)
This comment has been minimized.
This comment has been minimized.
@gotedkid195 please read the thread first. your question is answered in it. |
@untitaker you mean use
to reslove my issue. |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
A quick
|
The old raven library had this functionality, implemented for Django by declaring a list of names of errors in the settings file.
This kind of functionality is necessary to control error reporting spam.
The text was updated successfully, but these errors were encountered: