sonus21 / error-tracker Goto Github PK
View Code? Open in Web Editor NEWFull featured error tracking module for Python
Home Page: https://error-tracker.readthedocs.io/en/latest/
License: BSD 3-Clause "New" or "Revised" License
Full featured error tracking module for Python
Home Page: https://error-tracker.readthedocs.io/en/latest/
License: BSD 3-Clause "New" or "Revised" License
Hi, I tried to use this with Django and in the moment in put 'error_tracker.DjangoErrorTracker' in settings.py I have the error below.
File ".../lib/python3.7/site-packages/error_tracker/__init__.py", line 14, in <module>
from error_tracker.flask import *
File ".../lib/python3.7/site-packages/error_tracker/flask/__init__.py", line 10, in <module>
from .flask_error import AppErrorTracker
File ".../lib/python3.7/site-packages/error_tracker/flask/flask_error.py", line 15, in <module>
from flask import _request_ctx_stack as stack
ModuleNotFoundError: No module named 'flask'
Thank you.
Protect Django views (and probably Flask too). Most logically, admins only shall be able to use them.
Currently, this package depends on Flask, Django and Django-rest-framework, but is that really needed? Typically, when this library is used with django and/or django-rest-framework or Flask, then the application will already depend on those packages and error-tracker could just import them.
Typically an application will not use both Flask and Django at the same time, so this installs a bunch of packages that are never used.
Maybe the dependencies can be made optional using setup.py's "extra" feature, or just removed altogether (with the responsibility for installing these moved to the application). The latter might need some changes in the code (haven't checked) to ensure things are only imported when actually needed and/or to have a graceful fallback if imports are not available.
/error_tracker/django/init.py:28: UserWarning: APP_ERROR_DB_MODEL is not set using default model
warnings.warn("APP_ERROR_DB_MODEL is not set using default model")
/error_tracker/libs/utils.py:121: UserWarning: Default Masking module will be used
warnings.warn(message)
/error_tracker/libs/utils.py:121: UserWarning: Default Notification module will be used
warnings.warn(message)
/error_tracker/libs/utils.py:121: UserWarning: Default ContextBuilder module will be used
warnings.warn(message)
Hello,
the change
dependencies = [
('django', '0001_initial'),
]
to
dependencies = [
('error_tracker', '0001_initial'),
]
made migrations broken.
The error message
django.db.migrations.exceptions.NodeNotFoundError: Migration django.0002_auto_20201018_1311 dependencies reference nonexistent parent node ('error_tracker', '0001_initial')
Regards
Take Sentry SDK as a good example of such.
Capture errors
https://docs.sentry.io/platforms/python/#capturing-errors
from sentry_sdk import capture_exception
try:
a_potentially_failing_function()
except Exception as e:
# Alternatively the argument can be omitted
capture_exception(e)
Capture messages
https://docs.sentry.io/error-reporting/capturing/?platform=python#capturing-messages
from sentry_sdk import capture_message
capture_message('Something went wrong')
Extra context
https://docs.sentry.io/platforms/python/#extra-context
from sentry_sdk import configure_scope
with configure_scope() as scope:
scope.set_extra("character_name", "Mighty Fighter")
How do I suppress the UserWarnings
for some of the default options such as APP_ERROR_DB_MODEL
?
Lines like this
error-tracker/error_tracker/libs/utils.py
Line 121 in af0fa38
The class DefaultDjangoContextBuilder
of the error_tracker.django.utils
needs some extensions. In particular, in case of Django REST Framework (DRF), the request
instance has no POST (request.POST
is empty dict). Instead data is stored in request.data
. You could simply check, if it's instance of rest_framework.request.Request
, then handle as DRF request, otherwise standard Django.
I create the class on django
class Notifier(NotificationMixin):
def notify(self, request, exception,
email_subject=None,
email_body=None,
from_email=None,
recipient_list=None):
BaseSlackNotification.send_notification(f"{exception}\n {request}",
settings.SLACK_NEW_ERR0R)
I put on settings
APP_ERROR_NOTIFICATION_MODULE = "apps.commons.slack_notifications.Notifier"
and not works, in debugger never stop on method on exception, but the except show's on error page
To be raised an exception must derive from BaseException
File "/.../lib/python3.8/site-packages/error_tracker/django/__init__.py", line 43, in get_exception_model
raise warnings.warn(
TypeError: exceptions must derive from BaseException
Hi, I saw on the docs that I can set a model to replace the default ErrorModel but I need to implement all abstract methods. And if I want to extend the ErrorModel, this would be possible?
At the moment, errors are overwritten. A better approach would be to simply group similar errors together (Sentry way) and allow to navigate from one to another.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.