getsentry / sentry Goto Github PK
View Code? Open in Web Editor NEWDeveloper-first error tracking and performance monitoring
Home Page: https://sentry.io
License: Other
Developer-first error tracking and performance monitoring
Home Page: https://sentry.io
License: Other
Hi,
I asked before how to limit the amount of mail sent but the bug was closed. I still don't see anything like that in the code. Could you tell me where this feature is if there is any?
Thanks,
Batiste
SentryClient calls sentry.helpers.get_filters instead of sentry.views.get_filters. The former doesn't register models with indexer.
Had a few baffling moments when installing Sentry and it didn't seem to log anything. I figured out that I had a middleware catching all exceptions ( http://djangosnippets.org/snippets/935/ ) before reaching Sentry.
This is of course not a bug, but maybe worth mentioning in the docs (what docs?-).
Getting the following error, and I'm not sure what is spawning it....
KeyError
exc
Request Method: GET
Request URL: http://my_domain/sadmin/sentry/group/199
Exception Type: KeyError
Exception Value:
exc
Exception Location: /usr/local/lib/python2.6/dist-packages/django_sentry-1.5.4-py2.6.egg/sentry/views.py in group, line 239
TemplateSyntaxError at /sentry/group/6
Caught DatabaseError while rendering: ORA-01821: date format not recognized
Trace:
C:\Python26\lib\site-packages\django\db\backends\oracle\base.py in execute
args
[':arg0', ':arg1']
e
DatabaseError(<cx_Oracle._Error object at 0x02BFB410>,)
i
1
params
(<django.db.backends.oracle.base.OracleParam object at 0x02BFE830>, <django.db.backends.oracle.base.OracleParam object at 0x02BFE850>)
query
'SELECT (TRUNC(datetime, 'hour')) AS "GROUPER", COUNT("SENTRY_MESSAGE"."ID") AS "NUM" FROM "SENTRY_MESSAGE" WHERE ("SENTRY_MESSAGE"."GROUP_ID" = :arg0 AND "SENTRY_MESSAGE"."DATETIME" >= TO_TIMESTAMP(:arg1, 'YYYY-MM-DD HH24:MI:SS.FF') ) GROUP BY (TRUNC(datetime, 'hour')), TRUNC(datetime, 'hour') ORDER BY "GROUPER" ASC'
self
<django.db.backends.oracle.base.FormatStylePlaceholderCursor object at 0x02BFE5F0>
For Oracle should be used 'hh' (or 'hh24', or 'hh12') instead of the 'hour'
For Python 2.4 it now fails because it has uuid dependency ( http://pypi.python.org/pypi/uuid/1.30 )!
Have a separate stack for django-sentry set up. On main project, set up the SENTRY_REMOTE_URL to point to it.
When exceptions are thrown on the website, and the 500 status is served, the sentry client is not sending to the store url.
Using http://github.com/ashchristopher/sentry-server-stack as the sentry server, and just added sentry.client to my INSTALLED_APPS of the website.
Hi David,
I'm using this snippet from docs to set up sentry:
import logging from sentry.client.handlers import SentryHandler logging.getLogger().addHandler(SentryHandler()) # Add StreamHandler to sentry's default so you can catch missed exceptions logger = logging.getLogger('sentry.errors') logger.propagate = False logger.addHandler(logging.StreamHandler())
In my project code I'm trying to log how many times a function is called doing:
logging.info("processTrip being called")
I know that function is called 4 times per request. However, Sentry logs the message 8 times. After debugging logging and getting in sentry code, I realized you log the message for every handler. As I have two setup it double logs.
This is the first time I do logging in Python. I'm not sure if this is the desired behavior, but if it is I think you should warn this will happen in the documentation. What should I do?
Thanks, regards
Miguel Araujo
sentry.client uses urllib2.urlopen()
with the timeout option. This is only available on python 2.6 and higher.
The error happens here: http://github.com/dcramer/django-sentry/blob/675a779c67c686709e2cf8d52152a5a4fd848d09/sentry/client/base.py#L57
TypeError: urlopen() takes at most 2 arguments (3 given)
works fine on python 2.6 and 2.7
Something I've been thinking about recently is how we could provide an
extensible interface and integrate with solutions like Trac and
Redmine. My first idea is simply the ability to create a ticket
directly from Sentry based on an error (this wouldn't be automatic,
but I guess it could be). It would then keep the association between
the ticket tracker and Sentry as a reference point.
Anyone familiar with the systems or have additional thoughts?
This screenshot explains everything. I'm running the latest chrome dev build.
http://iv.pl/images/30834746785159818899.jpg
I assumed that SENTRY_KEY was just any random string that should be unique to a deployment and kept secret (ie, serving a similar purpose to django's SECRET_KEY) so I generated a random string to use there.
It turns out that it's used in a URL for the feeds:
url(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),
(in sentry.urls)
Mine happened to have an '[' in it which caused a very confusing error about an unterminated regex.
It should be documented that SENTRY_KEY will make it into a URL (and further that django will try to then parse it as a regexp when trying to do reverse lookups) and thus can't have most punctuation.
I'm getting a syntax error for 1.5.2 in search_indexes.py, preventing my application when Haystack searches for indexes. Below is some console output demonstrating the issue.
$ python sentry/search_indexes.py
File "sentry/search_indexes.py", line 10
return
SyntaxError: 'return' outside function
$ python --version
Python 2.6.5
Will it be possible to display the distinct sites that a message belong to on the Message Details page (/sentry/group/<group_id>/)? I'm thinking somewhere underneath the Meta column. It can be useful while going through many exceptions across multiple django sites.
TemplateSyntaxError: Caught DatabaseError while rendering: unrecognized token: ":"
I'm using sqlite as secondary DB, the query that is being executed is:
SELECT (log(times_seen) * 600 + last_seen::abstime::int) AS "score", "sentry_groupedmessage"."id", "sentry_groupedmessage"."logger", "sentry_groupedmessage"."class_name", "sentry_groupedmessage"."level", "sentry_groupedmessage"."message", "sentry_groupedmessage"."traceback", "sentry_groupedmessage"."view", "sentry_groupedmessage"."checksum", "sentry_groupedmessage"."status", "sentry_groupedmessage"."times_seen", "sentry_groupedmessage"."last_seen", "sentry_groupedmessage"."first_seen" FROM "sentry_groupedmessage" WHERE "sentry_groupedmessage"."status" = ? ORDER BY "score" DESC, "sentry_groupedmessage"."last_seen" DESC LIMIT 20
And when run in sqlite3, it gives an error for the ::
Hi,
I actually use a hand crafted tool to log errors in my project. Sometime there can be so many errors that I don't want to log all of them. Only a certain amount of the same error (I use the source of the error do know it's the same and group them).
Does django-sentry has some kind of similar mechanisms?
It is probably not beneficial to have sentry attempt to log errors when the test harness is running.
I use django to develop APIs, that often have a JSON payload. This will not be parsed correctly by django and turned into request.POST, but that is not important right now.
What is important is that this data is available in request.raw_post_data: and it is important in the case of a crash to know what this content is.
I suggest that sentry should display this when a request is passed in.
Running syncdb, I'm getting this:
Creating table sentry_groupedmessage
Traceback (most recent call last):
File "manage.py", line 11, in
execute_manager(settings)
File "/usr/local/alwaysdata/python/django/1.2.3/django/core/management/init.py", line 438, in execute_manager
utility.execute()
File "/usr/local/alwaysdata/python/django/1.2.3/django/core/management/init.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/alwaysdata/python/django/1.2.3/django/core/management/base.py", line 191, in run_from_argv
self.execute(_args, *_options.dict)
File "/usr/local/alwaysdata/python/django/1.2.3/django/core/management/base.py", line 220, in execute
output = self.handle(_args, *_options)
File "/usr/local/alwaysdata/python/django/1.2.3/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/usr/local/alwaysdata/python/django/1.2.3/django/core/management/commands/syncdb.py", line 95, in handle_noargs
cursor.execute(statement)
File "/usr/local/alwaysdata/python/django/1.2.3/django/db/backends/util.py", line 15, in execute
return self.cursor.execute(sql, params)
File "/usr/local/alwaysdata/python/django/1.2.3/django/db/backends/mysql/base.py", line 86, in execute
return self.cursor.execute(query, args)
File "/usr/local/lib/python2.6/site-packages/MySQLdb/cursors.py", line 166, in execute
self.errorhandler(self, exc, value)
File "/usr/local/lib/python2.6/site-packages/MySQLdb/connections.py", line 35, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1071, 'Specified key was too long; max key length is 1000 bytes')
django-sentry version: 1.3.6
mysql version: 5.1.39
We need to move our README into some real docs as it's getting to be far too big and could use better examples.
This blew up on me on MySQL. I just faked it and everything seems to be working, but here's the traceback:
(BTW, otherwise super easy to set up and looks really promising. I just added your logging handler to all my loggers and was getting sentry messages in less than 5 minutes)
sentry:0006_auto
! Error found during real run of migration! Aborting.
! Since you have a database that does not support running
! schema-altering statements in transactions, we have had
! to leave it in an interim state between migrations.
! You might be able to recover with: = CREATE INDEX sentry_groupedmessage_view
ON sentry_groupedmessage
(view
); []
= CREATE INDEX sentry_groupedmessage_checksum
ON sentry_groupedmessage
(checksum
); []
= CREATE INDEX sentry_message_view
ON sentry_message
(view
); []
= CREATE INDEX sentry_message_checksum
ON sentry_message
(checksum
); []
! The South developers regret this has happened, and would
! like to gently persuade you to consider a slightly
! easier-to-deal-with DBMS.
! NOTE: The error which caused the migration to fail is further up.
Traceback (most recent call last):
File "./manage.py", line 21, in
execute_from_command_line()
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/django/core/management/init.py", line 429, in execute_from_command_line
utility.execute()
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/django/core/management/init.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(_args, *_options.dict)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/django/core/management/base.py", line 218, in execute
output = self.handle(_args, *_options)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/south/management/commands/migrate.py", line 105, in handle
ignore_ghosts = ignore_ghosts,
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/south/migration/init.py", line 191, in migrate_app
success = migrator.migrate_many(target, workplan, database)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/south/migration/migrators.py", line 221, in migrate_many
result = migrator.class.migrate_many(migrator, target, migrations, database)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/south/migration/migrators.py", line 292, in migrate_many
result = self.migrate(migration, database)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/south/migration/migrators.py", line 125, in migrate
result = self.run(migration)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/south/migration/migrators.py", line 99, in run
return self.run_migration(migration)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/south/migration/migrators.py", line 81, in run_migration
migration_function()
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/south/migration/migrators.py", line 57, in
return (lambda: direction(orm))
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/sentry/migrations/0006_auto.py", line 12, in forwards
db.delete_index('sentry_message', ['checksum'])
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/south/db/generic.py", line 676, in delete_index
self.execute(sql)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/south/db/generic.py", line 137, in execute
cursor.execute(sql, params)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/django/db/backends/util.py", line 15, in execute
return self.cursor.execute(sql, params)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 86, in execute
return self.cursor.execute(query, args)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "/Users/zach/Development/yipit-env/lib/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1091, "Can't DROP 'sentry_message_checksum'; check that column/key exists")
Not a bug, but would be nice to be able to resolve multiple items at once
Sentry has some permissions to allow access to sentry for non superusers. This is currently not working. Due to a typo in the view that checks this permission.
allowed access to sentry
you get redirected to sentry/login
1.3.14
--- /tmp/views.py 2010-12-16 15:48:39.000000000 +0100
+++ /opt/python2.5/lib/python2.5/site-packages/sentry/views.py 2010-12-16 15:48:53.000000000 +0100
@@ -29,7 +29,7 @@
if not conf.PUBLIC:
if not request.user.is_authenticated():
return HttpResponseRedirect(reverse('sentry-login'))
- if not request.user.has_perm('sentry_groupedmessage.can_view'):
+ if not request.user.has_perm('sentry.can_view'):
return HttpResponseRedirect(reverse('sentry-login'))
return func(request, _args, *_kwargs)
wrapped.doc = func.doc
I'm showing dates in the future for my log items. I think this is a problem with the HighCharts data section of the data series:
https://skitch.com/adamnelson/r8t7y/pushing-active-deals-to-rabbitmq-django-sentry
Sometimes I get this error, resulting in trouble with seeing new results in Sentry. I am using the celery backend (which may cause concurrent actions), and it would appear this get() call is not being enforced by a database constraint.
This tends to occur after extensive frobbing of the database during development; I'm not sure exactly what the reproduction steps are.
v1.3.14
Traceback (most recent call last): File "/opt/project/py/venv/lib/python2.6/site-packages/django_sentry-1.3.14-py2.6.egg/sentry/manager.py", line 55, in from_kwargs defaults=kwargs File "/opt/project/py/venv/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/db/models/manager.py", line 135, in get_or_create return self.get_query_set().get_or_create(**kwargs) File "/opt/project/py/venv/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/db/models/query.py", line 366, in get_or_create return self.get(**kwargs), False File "/opt/project/py/venv/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/db/models/query.py", line 343, in get % (self.model._meta.object_name, num, kwargs)) MultipleObjectsReturned: get() returned more than one GroupedMessage -- it returned 2! Lookup parameters were {'checksum': '5025fae34aa2640479d06e22e62ab8d4', 'logger': '\ project.tasks', 'view': None}
Hi,
I'm using sentry for the first time, and I've noticed the migrations have some disorder in them.
In particular, migration 6 is empty, and the "backwards" direction in migration 8 doesn't match the situation before it (apparently at some point, FilterValue.value was 255 chars long, but migration 4 which introduces it sets its length to 200).
Do you now of any particular reason why sqllite shouldn't work? The tests won't pass at the moment... Can file full report if it would help, or you care about supporting sqllite.
Traceback (most recent call last):
File "ReportError.py", line 26, in ?
error_client.create_from_exception()
File "/usr/lib/python2.4/site-packages/django_sentry-1.3.14-py2.4.egg/sentry/client/base.py", line 182, in create_from_exception
data['sentry'] = {
AttributeError: class ZeroDivisionError has no attribute 'class'
Moved this to Wiki: https://github.com/dcramer/django-sentry/wiki/Sentry-2.0
https://github.com/dcramer/django-sentry/blob/master/sentry/client/middleware.py
I think it's not working because 404 that happens during URL resolving is not passed to middleware exception handlers:
http://code.djangoproject.com/browser/django/tags/releases/1.2.4/django/core/handlers/base.py#L90
resolver.resolve() raises a subclass of Http404 which is handled by regular 404 handler:
http://code.djangoproject.com/browser/django/tags/releases/1.2.4/django/core/handlers/base.py#L120
Summarizing, 404 logging has to be done some other way.
Hi there,
I'm setting sentry in my testing project to see how it works. After reading docs, I realized that you it is not mentioned anywhere that you have to include sentry.urls
in your urlpatterns
. Then you should go to login. Some people might find this hard to find out. I just got into the urls.py
Thanks, regards
Miguel Araujo
I think this dependency should be documented (pip install django-paging, add 'paging' to INSTALLED_APPS).
I have Django deployed with Nginx and uWsgi. If I use ./manage.py runserver sentry works just fine, all exceptions are transferred to another server. However, the same settings deployed over uWsgi do not work. Sentry does not transmit any data. When I set DEBUG = False Sentry does not seem to work.
PS: Re-created the issue because I unintentionally closed the previous one.
I have installed django-sentry for a couple of days, and when go to the root of my site: '/' i get my home after almost a second in my laptop, i'm talking about a development environment when the only code in my home is:
def index(request):
data = {}
data['edit_form'] = EditProfileForm()
return render_to_response('test.html', data, context_instance=RequestContext(request))
And i get 37 queries from django-sentry, it is my mistake or django-sentry have a serious issue about the performance?
if i remove this:
import logging
from sentry.client.handlers import SentryHandler
logging.getLogger().addHandler(SentryHandler())
logging.getLogger('sentry.errors').addHandler(logging.StreamHandler())
i get the index in 300 ms and only one query
This query:
https://github.com/dcramer/django-sentry/blob/master/sentry/views.py#L237
Sometimes returns zero results. This particular exception I am capturing in a "process_exception" method on a middleware (not sure if that matters).
Traceback:
File "/home/x/src/django/django/core/handlers/base.py" in get_response
response = callback(request, _callback_args, *_callback_kwargs)
return func(request, _args, *_kwargs)
obj = group.message_set.all().order_by('-id')[0]
return list(qs)[0]
Exception Type: IndexError at /sentry/group/98
Exception Value: list index out of range
I have Django deployed with Nginx and uWsgi. If I use ./manage.py runserver sentry works just fine, all exceptions are transferred to another server. However, the same settings deployed over uWsgi do not work. Sentry does not transmit any data.
The README says that anything passed as extra that isn't reserved or private will show up in the dashboard. To get data to actually show up, you have to pass the desired dictionary inside another dictionary as the value for 'data' (e.g. extra={'data': {'username': request.user.username}}
). See SentryClient.create_from_record to see why.
It's reasonable behavior, so I think the README just needs to be edited to reflect it.
Sentry URLConf has sentry-media URL which uses staticmedia views. In Django 1.3 the updated staticmedia view method raises ImproperlyConfigured error when DEBUG=False.
Maybe a SENTRY_MEDIA_URL conf or similar which may or may not be used when developing but have to be used in production? Also, documentation should be updated relating to this.
I have a Sentry installation which is working just fine, except that the error frequency chart is showing dates until Dec. 18th (today is 11/29). The max() value of datetime in the Sentry message table in my DB is 11/29, so it seems to be a Highcharts/Javascript display issue. Not sure what other information to include other than maybe the code that's generating the chart:
<script type="text/javascript">
$(document).ready(function() {
new Highcharts.Chart({
chart: {
renderTo: 'chart',
zoomType: 'x',
marginLeft: 50,
marginRight: 20,
marginTop: 20,
marginBottom: 40,
backgroundColor: '#eeeeee',
showAxes: false,
height: 200
},
title: {
text: false
},
xAxis: {
type: 'datetime',
maxZoom: 24 * 3600000, // 1 day
title: {
text: false
},
showFirstLabel: false,
dateTimeLabelFormats: {
second: '%H:%M:%S',
minute: '%H:%M',
hour: '%d %b %H:%M',
day: '%e. %b',
week: '%e. %b',
month: '%b \'%y',
year: '%Y'
}
},
yAxis: {
title: {
text: false
}
},
tooltip: {
formatter: function() {
return '<strong>'+
Highcharts.dateFormat('%A %B %e %Y<br/>%I:00 %p', this.x) + '</strong><br/>'+
this.y+' records';
}
},
series: [{
pointStart: new Date() - 30 * 3600000,
pointInterval: 3600 * 1000,
type: 'area',
data: [31, 33, 1, 7, 28, 34, 0, 0, 0, 25, 0, 4, 42, 45, 39, 9, 30, 37, 47, 0, 0, 22, 20, 27, 53, 24, 0, 19, 1, 1, 1, 0, 32, 12, 11, 9, 5, 7, 15, 33, 22, 26, 19, 13, 23, 27, 25, 44, 13, 2, 24, 17, 17, 47, 29, 13, 2, 33, 0, 0, 0, 0, 10, 21, 34, 42, 10, 10, 39, 32, 25, 37, 33, 18, 8, 29, 27, 4, 1, 3, 13, 26, 36, 37, 20, 16, 36, 37, 43, 43, 45, 24, 23, 39, 35, 34, 44, 32, 31, 37, 31, 28, 47, 27, 25, 45, 23, 21, 33, 27, 23, 40, 25, 39, 5, 16, 30, 51, 38, 18, 31, 42, 37, 10, 8, 39, 36, 38, 4, 30, 19, 16, 22, 31, 32, 52, 11, 36, 25, 34, 54, 30, 3, 42, 50, 34, 30, 24, 22, 38, 38, 0, 27, 50, 10, 40, 0, 0, 13, 19, 24, 36, 40, 39, 17, 31, 14, 23, 42, 0, 35, 42, 38, 39, 39, 18, 43, 25, 20, 24, 33, 0, 0, 0, 1, 40, 0, 10, 0, 20, 3, 43, 10, 10, 10, 20, 0, 44, 20, 10, 0, 10, 0, 21, 22, 21, 0, 0, 1, 41, 0, 0, 0, 0, 0, 38, 42, 2, 0, 10, 0, 1, 41, 20, 16, 39, 31, 37, 31, 40, 42, 25, 24, 4, 15, 19, 8, 6, 9, 2, 3, 6, 5, 7, 1, 3, 2, 21, 3, 6, 3, 1, 5, 11, 18, 15, 21, 23, 26, 41, 32, 45, 15, 30, 29, 30, 31, 0, 41, 24, 28, 41, 20, 37, 38, 10, 2, 43, 10, 10, 0, 0, 43, 22, 31, 5, 15, 5, 6, 26, 10, 10, 57, 20, 20, 10, 25, 20, 22, 10, 34, 23, 43, 32, 48, 38, 16, 24, 35, 46, 48, 42, 47, 37, 23, 36, 26, 0, 5, 45, 20, 26, 20, 53, 33, 15, 35, 23, 16, 14, 39, 30, 29, 10, 13, 14, 26, 0, 0, 23, 0, 0, 20, 23, 47, 0, 0, 0, 10, 20, 21, 21, 0, 0, 0, 41, 22, 0, 0, 0, 0, 22, 20, 21, 11, 0, 0, 0, 0, 24, 29, 21, 7, 38, 26, 17, 0, 0, 0, 22, 3, 21, 0, 0, 0, 29, 21, 20, 10, 3, 27, 24, 32, 38, 0, 11, 10, 0, 24, 39, 18, 29, 33, 40, 16, 16, 18, 32, 34, 17, 17, 28, 27, 38, 41, 23, 19, 3, 34, 9, 26, 12, 6, 43, 5, 1, 13, 24, 6, 4, 6, 5, 31, 7, 0, 9, 27, 15, 9, 11, 15, 32, 14, 19, 9, 13, 3, 28, 33, 31, 13, 8, 4, 4, 5, 23, 37, 29, 19, 16, 3, 16, 6, 17, 30, 32, 40, 14, 10, 8, 5, 12, 8, 4, 11, 11, 2, 0, 1, 1]
}],
legend: {
enabled: false
},
plotOptions: {
area: {
lineWidth: 1,
marker: {
enabled: false,
states: {
hover: {
enabled: true,
radius: 5
}
}
},
shadow: false,
states: {
hover: {
lineWidth: 1
}
}
}
},
});
});
</script>
http://dcramer.github.com/django-sentry/install.html#requirements shows Django>=1.1 but AFAIK the requirement is Django 1.2 (got an error on loading csrf context_processor with 1.1)
This ticket describes removing the Django dependency on the Sentry client. The server itself could potentially be rewritten to use generic libraries, for for now it's not important. The cilent ideally should work as a WSGI middleware and be able to dispatch errors via HTTP POST to the server (which would be the standard).
As in the topic. It's quite annoying that I can't view any of old errors.
Regards.
http://www.pastethat.com/pylad
Here's the traceback
Environment:
Request Method: GET
Python Version: 2.6
Traceback:
File "/usr/local/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
response = callback(request, _callback_args, *_callback_kwargs)
return func(request, _args, *_kwargs)
obj = group.message_set.all().order_by('-id')[0]
return list(qs)[0]
Exception Type: IndexError at /sentry/group/1
Exception Value: list index out of range
This query is slow (around 350ms for me). I think a faster scoring algorithm could probably be found.
```SELECT (log(times_seen) * 600 + unix_timestamp(last_seen)) ASscore
,`sentry_groupedmessage`.`id`,`sentry_groupedmessage`.`logger`,`sentry_groupedmessage`.`class_name`,`sentry_groupedmessage`.`level`,`sentry_groupedmessage`.`message`,`sentry_groupedmessage`.`traceback`,`sentry_groupedmessage`.`view`,`sentry_groupedmessage`.`checksum`,`sentry_groupedmessage`.`data`,`sentry_groupedmessage`.`status`,`sentry_groupedmessage`.`times_seen`,`sentry_groupedmessage`.`last_seen`,`sentry_groupedmessage`.`first_seen`FROM`sentry_groupedmessage`WHERE`sentry_groupedmessage`.`status`= 0 ORDER BY`score`DESC,`sentry_groupedmessage`.`last_seen` DESC LIMIT 15
This is ok for debug = True, but in production these should be served via the media server / django static files
Out of the box, it may or may not be possible to route logging.info() and routing.debug() to Sentry, but I have been unable to find a way to do so. logging.error() seems to route to Sentry just fine, but not the others. Is there a way to do this without writing a plugin for it? If so, this should be made more clear in the documentation.
Times seen is useful, and always available, but there are many use cases where log messages would be better to group by some other value.
Cases are:
Various sort methods would be:
We need to determine the best way to sort this data. Some ideas:
Screenshot:
When using Sentry logging integration in combination with the 'data' payload in 'extra' (as seen at http://dcramer.github.com/django-sentry/config.html#integration-with-logging) it is not uncommon for the keys of the dictionary to spill over and obscure the values they are associated with. To get around this, I view source/inspect element on the page at the moment.
When hitting a specific exception in Sentry I get the following error in my Apache logs:
[error] Unable to process log entry: Can't pickle <class 'django.utils.functional.__proxy__'>: attribute lookup django.utils.functional.__proxy__ failed
[error] Traceback (most recent call last):
[error] File "<path_to_sentry>/sentry/client/models.py", line 49, in sentry_exception_handler
[error] client.create_from_exception(**extra)
[error] File "<path_to_sentry>/sentry/client/base.py", line 210, in create_from_exception
[error] **kwargs
[error] File "<path_to_sentry>/sentry/client/base.py", line 53, in process
[error] return self.send(**kwargs)
[error] File "<path_to_sentry>/sentry/client/base.py", line 59, in send
[error] 'data': base64.b64encode(pickle.dumps(kwargs).encode('zlib')),
[error] PicklingError: Can't pickle <class 'django.utils.functional.__proxy__'>: attribute lookup django.utils.functional.__proxy__ failed
There clearly seems to be some kind of object which Sentry is not able to pickle, which is understandable. However, I would really like this to show up on my Sentry logging server. Ideally, unpickleable objects should be skipped gracefully so I would at least get the rest of my error.
After sentry has been switched off and debugging mode has been switched on (I really feel uncomfortable doing this in a production environment...), I'm getting the following ValueError
from django/core/files/base.py
:
def open(self, mode=None):
if not self.closed:
self.seek(0)
elif self.name and os.path.exists(self.name):
self.file = open(self.name, mode or self.mode)
else:
raise ValueError("The file cannot be reopened.") ...
(The rest of the stack trace suggests that this is an issue with easy-thumbnails. But that is besides the point: this error and stacktrace should be logged to sentry and not somewhere else.)
The configuration options pertaining to Sentry are as folllows:
# Sentry settings
# What should these site's errors by called in the log?
SENTRY_NAME = '<private>'
SENTRY_KEY = '<private>'
SENTRY_REMOTE_URL = 'http://<private>/store/'
# Just one daily email
ADMINS = ()
SENTRY_ADMINS = (
('Log', '<private>'),
)
MANAGERS = SENTRY_ADMINS
# General logging
# No debuggin and log errors & warnings to sentry
import logging
logging.basicConfig(level=logging.WARNING,
format='%(levelname)-8s %(message)s')
from sentry.client.handlers import SentryHandler
logger = logging.getLogger()
# ensure we havent already registered the handler
if SentryHandler not in map(lambda x: x.__class__, logger.handlers):
logger.addHandler(SentryHandler())
# Add StreamHandler to sentry's default so you can catch missed exceptions
logger = logging.getLogger('sentry.errors')
logger.propagate = False
logger.addHandler(logging.StreamHandler())
Any help would be greatly appreciated!
I'm running Sentry 1.4.1 on Django 1.1.2 on Python 2.6.4.
Using this view:
from markupsafe import Markup, escape, soft_unicode
def test(request):
x = soft_unicode(escape("<script>alert(document.cookie);</script>"))
raise
I get this on the server:
ERROR 2011-01-05 09:16:37,604 views 11324 140289879529216 Bad data received
Traceback (most recent call last):
File "/home/florian/.virtualenvs/sentry/lib/python2.6/site-packages/django_sentry-1.5.3-py2.6.egg/sentry/views.py", line 318, in store
data = pickle.loads(base64.b64decode(data).decode('zlib'))
ImportError: No module named markupsafe
Reason is that force_unicode (https://github.com/dcramer/django-sentry/blob/master/sentry/helpers.py#L88) doesn't really return unicode for all objects; eg markupsafe.Markup (http://pypi.python.org/pypi/MarkupSafe) -- hence pickle.dumps doesn't dump a string but the class; which doesn't exist on the target system. One fix would be to call unicode() again on the returned value.
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.