mirror of
https://github.com/bugsink/bugsink.git
synced 2026-01-07 05:40:26 -06:00
"possibly expensive" turned out to be "actually expensive". On 'emu', with 1.5M events, the counts take 85 and 154 ms for Project and Issue respectively; bottlenecking our digestion to ~3 events/s. Note: this is single-issue, single-project (presumably, the cost would be lower for more spread-out cases) Note on indexes: Event already has indexes for both Project & Issue (though as the first item in a multi-column index). Without checking further: that appears to not "magically solve counting". This commit also optimizes the .count() on the issue-detail event list (via Paginator). This commit also slightly changes the value passed as `stored_event_count` to be used for `get_random_irrelevance` to be the post-evication value. That won't matter much in practice, but is slightly more correct IMHO.
82 lines
1.7 KiB
Python
82 lines
1.7 KiB
Python
from django.contrib import admin
|
|
|
|
from .models import Issue, Grouping, TurningPoint
|
|
from .forms import IssueAdminForm
|
|
|
|
|
|
class GroupingInline(admin.TabularInline):
|
|
model = Grouping
|
|
extra = 0
|
|
exclude = ['project']
|
|
readonly_fields = [
|
|
'grouping_key',
|
|
]
|
|
|
|
|
|
class TurningPointInline(admin.TabularInline):
|
|
model = TurningPoint
|
|
extra = 0
|
|
exclude = ['project']
|
|
fields = [
|
|
"kind",
|
|
"timestamp",
|
|
"user",
|
|
"triggering_event",
|
|
"metadata",
|
|
"comment",
|
|
]
|
|
readonly_fields = [
|
|
"user", # readonly because it avoid thinking about well-implemented select-boxes
|
|
"triggering_event", # readonly because it avoid thinking about well-implemented select-boxes
|
|
"metadata", # readonly to avoid a big textbox
|
|
"comment", # readonly to avoid a big textbox
|
|
]
|
|
|
|
|
|
@admin.register(Issue)
|
|
class IssueAdmin(admin.ModelAdmin):
|
|
form = IssueAdminForm
|
|
|
|
fields = [
|
|
'project',
|
|
'friendly_id',
|
|
'calculated_type',
|
|
'calculated_value',
|
|
'last_seen',
|
|
'first_seen',
|
|
'is_resolved',
|
|
'fixed_at',
|
|
'events_at',
|
|
'is_muted',
|
|
'unmute_on_volume_based_conditions',
|
|
'unmute_after',
|
|
'digested_event_count',
|
|
'stored_event_count',
|
|
]
|
|
|
|
inlines = [
|
|
GroupingInline,
|
|
TurningPointInline,
|
|
]
|
|
|
|
list_display = [
|
|
"title",
|
|
"project",
|
|
"digested_event_count",
|
|
"stored_event_count",
|
|
]
|
|
list_filter = [
|
|
"project",
|
|
]
|
|
|
|
exclude = ["events"]
|
|
|
|
readonly_fields = [
|
|
'project',
|
|
'friendly_id',
|
|
'calculated_type',
|
|
'calculated_value',
|
|
'digested_event_count',
|
|
'stored_event_count',
|
|
]
|