mirror of
https://github.com/bugsink/bugsink.git
synced 2025-12-19 03:19:52 -06:00
The ugliest thing that could get a stacktrace on screen
This commit is contained in:
0
events/__init__.py
Normal file
0
events/__init__.py
Normal file
3
events/admin.py
Normal file
3
events/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
6
events/apps.py
Normal file
6
events/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class EventsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'events'
|
||||
0
events/migrations/__init__.py
Normal file
0
events/migrations/__init__.py
Normal file
3
events/models.py
Normal file
3
events/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
34
events/templates/events/event_detail.html
Normal file
34
events/templates/events/event_detail.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<html>
|
||||
|
||||
|
||||
{% for exception in exceptions %}
|
||||
<h1>{{ exception.type }}: {{ exception.value }}</h1>
|
||||
<b>{{ parsed_data.request.url }}</b><br>
|
||||
|
||||
{% for frame in exception.stacktrace.frames %}
|
||||
|
||||
<p>
|
||||
<br>
|
||||
<b>{{ frame.filename }} line {{ frame.lineno }}, in {{ frame.function }}.</b><br>
|
||||
|
||||
<pre>
|
||||
{% for line in frame.pre_context %}{{ line }}
|
||||
{% endfor %}<b>{{ frame.context_line }}</b>
|
||||
{% for line in frame.post_context %}{{ line }}
|
||||
{% endfor %}
|
||||
</pre>
|
||||
|
||||
{% for var, value in frame.vars.items %}
|
||||
<b>{{ var }}</b>: <i>{{ value }}</i></br>
|
||||
{% endfor %}
|
||||
|
||||
</p>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% if not forloop.last %}While handling the above exception, yad yad<br>{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
</html>
|
||||
3
events/tests.py
Normal file
3
events/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
8
events/urls.py
Normal file
8
events/urls.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import decompressed_event_detail
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('event/<uuid:pk>/', decompressed_event_detail),
|
||||
]
|
||||
21
events/views.py
Normal file
21
events/views.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import json
|
||||
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
|
||||
from ingest.models import DecompressedEvent
|
||||
|
||||
|
||||
def decompressed_event_detail(request, pk):
|
||||
# this view is misplaced "by nature" (it mixes ingested stuff and rendering); until we create a pipeline for that.
|
||||
obj = get_object_or_404(DecompressedEvent, pk=pk)
|
||||
|
||||
parsed_data = json.loads(obj.data)
|
||||
|
||||
# NOTE: instead of values, this may also just be a flat list; TODO implement this
|
||||
exceptions = parsed_data["exception"]["values"]
|
||||
|
||||
return render(request, "events/event_detail.html", {
|
||||
"obj": obj,
|
||||
"parsed_data": parsed_data,
|
||||
"exceptions": exceptions,
|
||||
})
|
||||
@@ -11,3 +11,7 @@ class DecompressedEvent(models.Model):
|
||||
project = models.ForeignKey(Project, blank=False, null=True, on_delete=models.SET_NULL) # SET_NULL: cleanup 'later'
|
||||
data = models.TextField(blank=False, null=False)
|
||||
timestamp = models.DateTimeField(null=False, auto_now_add=True, help_text="Server-side timestamp")
|
||||
|
||||
def get_absolute_url(self):
|
||||
# same note about misplacement as the view this is pointing to
|
||||
return "/events/event/%s/" % self.id
|
||||
|
||||
0
issues/__init__.py
Normal file
0
issues/__init__.py
Normal file
3
issues/admin.py
Normal file
3
issues/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
6
issues/apps.py
Normal file
6
issues/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class IssuesConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'issues'
|
||||
0
issues/migrations/__init__.py
Normal file
0
issues/migrations/__init__.py
Normal file
3
issues/models.py
Normal file
3
issues/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
3
issues/tests.py
Normal file
3
issues/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
issues/views.py
Normal file
3
issues/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
@@ -30,6 +30,8 @@ INSTALLED_APPS = [
|
||||
|
||||
'projects',
|
||||
'ingest',
|
||||
'issues',
|
||||
'events',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
||||
@@ -7,7 +7,9 @@ from .views import trigger_error
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('api/', include('ingest.urls')),
|
||||
path('api/', include('ingest.urls')),
|
||||
|
||||
path('events/', include('events.urls')),
|
||||
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user