Commit Graph

115 Commits

Author SHA1 Message Date
Klaas van Schelven
354af7ea0a Fix issues as reported by bandit or mark as nosec
Nothing worrying, but good to have checked this regardless
and important to have a green pipeline.

Fix #175
2025-07-30 12:16:40 +02:00
Klaas van Schelven
ceca12940b Breadcrumb timestamps: display harmonized w/ rest of application
in the correct timezone, with smaller milis

According to the spec, this should work because:

> The timestamp of the breadcrumb. Recommended. A timestamp representing when
> the breadcrumb occurred. The format is either a string as defined in [RFC
> 3339](https://tools.ietf.org/html/rfc3339) or a numeric (integer or float)
> value representing the number of seconds that have elapsed since the [Unix
> epoch](https://en.wikipedia.org/wiki/Unix_time). Breadcrumbs are most useful
> when they include a timestamp, as it creates a timeline leading up to an
> event.
2025-07-28 10:24:48 +02:00
Klaas van Schelven
6b8d912e1a Store remote_addr on the event
Fix #165
2025-07-25 21:54:32 +02:00
Klaas van Schelven
1983633b38 Sourcemap Images IDs: show those in event_details
See #158
2025-07-23 10:38:45 +02:00
Klaas van Schelven
7b340fd8ff Hide in-progress deletions of Project & Issue from the UI
I've done a full grep on Issue.objects, Project.objects and get_object_or_404
equivelents, and applying some common sense. The goal: avoid having
confusing/half-broken pages in the UI.

On index-usage: I've decided not to update the indexes. The assumption is:
`is_deleted` items will be a tiny minority of items in general, making the
cost/benefit analysis not turn out favorably (just scanning them out as a final
step is more efficient).  Also: sqlite is able to use the correct index without
adding a special one, proof:

```
EXPLAIN QUERY PLAN SELECT [..] WHERE ("issues_issue"."project_id" = 1 AND "issues_issue"."is_muted" = (0) AND "issues_issue"."is_resolved" = (0)) ORDER BY "issues_issue"."last_seen" DESC LIMIT 250;
QUERY PLAN
`--SEARCH issues_issue USING INDEX issue_list_open (project_id=? AND is_resolved=? AND is_muted=?)

EXPLAIN QUERY PLAN SELECT [..] WHERE ("issues_issue"."project_id" = 1 AND "issues_issue"."is_muted" = (0) AND "issues_issue"."is_resolved" = (0) AND "issues_issue"."is_deleted" = 0) ORDER BY "issues_issue"."last_seen" DESC LIMIT 250;
QUERY PLAN
`--SEARCH issues_issue USING INDEX issue_list_open (project_id=? AND is_resolved=? AND is_muted=?)
```

See #139 for the 0/1 notation in the above.

(Project-indexes: not an issue, the scale is "below relevance for indexes")
2025-07-07 10:27:36 +02:00
Klaas van Schelven
308034aadd Issue-delete from the UI (in the list-view)
See #50
2025-07-04 21:25:57 +02:00
Klaas van Schelven
6b9e4d8011 Project.delete_deferred(): first version (WIP)
Implemented using a batch-wise dependency-scanner in delayed
(snappea) style.

* no real point-of-entry in the (regular, non-admin) UI yet.
* no hiding of Projects which are delete-in-progress from the UI

* lack of DRY
* some unnessary work (needed in the Issue-context, but not here)
  is still being done.

See #50
2025-07-03 21:01:28 +02:00
Klaas van Schelven
33d5865579 Clarifying comments on logmessage display 2025-06-03 15:47:46 +02:00
Klaas van Schelven
5d316332d0 Display formatted log message when available
Fix #111
2025-06-03 15:44:36 +02:00
Klaas van Schelven
3f43981475 Fix (obj not found) when visiting project as a superuser
project of which you're not a member
2025-05-09 16:47:21 +02:00
Klaas van Schelven
0dfd01db9b Performance: don't evaluate all project issues to show/hide checkbox
Doing so is expensive (to the point of timeout) for largish numbers
of issues.
2025-05-06 23:01:09 +02:00
Klaas van Schelven
3783661054 Issue Paginator: don't attempt to count the Issues
Counting incurs looking at all records which is too expensive if you have e.g.
1_000_000 issues.

Note that we take a different approach than the one for Events (where we
count-with-timeout). Reason for switching:
https://sqlite.org/forum/forumpost/fa65709226

For Events we have a known count for the non-query case (denormalized/counted
value), so we preserve what we had there. For Issues the trouble of keeping
counts right for muted/etc. is not (currently) worth it.
2025-05-06 10:13:06 +02:00
Klaas van Schelven
1084796763 When not dogfooding, just print a regular stacktrace in the logs
This will hopefully help when getting issue-reports for those that
have not set up dogfooding.

See [Dogfooding Bugsink](https://www.bugsink.com/docs/dogfooding/)
2025-04-11 13:22:37 +02:00
Klaas van Schelven
5d01214752 Sourcemaps: a test
See #19
2025-04-11 10:32:13 +02:00
Klaas van Schelven
87130043e3 PoC of using sourcemaps in the UI
See #19
2025-04-10 15:52:34 +02:00
Klaas van Schelven
3daf3ce772 Document that interrupting SELECT in sqlite works as we expect 2025-03-31 13:16:01 +02:00
Klaas van Schelven
66b384a87d issue UI pages: optimization
no need to calculate event_qs_count (which is potentially expensive) if that's
not used in display.

when counting was moved from the template to the view (in 1eea9268a5) it was
made unconditional; here we restore that behavior.
2025-03-31 13:07:32 +02:00
Klaas van Schelven
5a9bab9e20 EagerPaginator
as explained in the comment
2025-03-13 14:49:49 +01:00
Klaas van Schelven
175e103d23 Search optimization: when counting the results takes too long, don't 2025-03-12 21:26:47 +01:00
Klaas van Schelven
c3ed995ecc Performance (of non-search): don't count if you know the answer 2025-03-12 20:44:50 +01:00
Klaas van Schelven
1eea9268a5 Optimization: Search on EvenTag without involving Event if possible
When searching by tag, there is no need to join with Event; especially when
just counting results or determining first/last digest_order (for navigation).

(For the above "no need" to be actually true, digest_order was denormalized
into EventTag).

The above is implemented in `search_events_optimized`.

Further improvements:

* the bounds of `digest_order` are fetched only once; for first/last this info
  is reused.

* explicitly pass `event_qs_count` to the templates

* non-event pages used to calculate a "last event" to generate a tab with a
  correct event.id; since we simply have the "last" idiom, better use that.
  this also makes clear the "none" idiom was never needed, we remove it again.

Results:

Locally (60K event DB, 30K events on largest issue) my testbatch now
runs in 25% of time (overall).

* The effect on the AND-ing are in fact very large (13% runtime remaining)
* The event details page is not noticably improved.
2025-03-12 20:38:07 +01:00
Klaas van Schelven
b031792784 Event (tag) search: performance improvement
Done by denormalizing EventTag.issue, and adding that into an index. Targets:

* get-event-within-query (when it's 'last' or 'first')
* .count (of search query results)
* min/max (for the first/prev/next/last buttons)

(The min/max query's performance significantly improved by the addition of
the index, but was also rewritten into a simple SELECT rather than MIN/MAX).

When this code was written, I thought I had spectacularly improved performance.
I now believe this was based on an error in my measurements, but that this
still represents (mostly) an improvement, so I'll let it stand and will take
it from here in subsequent commits.
2025-03-12 14:11:43 +01:00
Klaas van Schelven
f548eab778 Merge branch 'main' into tag-search 2025-03-10 09:09:40 +01:00
Klaas van Schelven
39bddb14b7 handled: searchable as a tag
also: don't display this in the detail view when the value isn't actually
in the data
2025-03-06 15:19:55 +01:00
Klaas van Schelven
646b1ea090 Details page: be robust for top-level message-as-string
Fix #55
2025-03-06 13:09:29 +01:00
Klaas van Schelven
20a54381dc Refactor: move tags/search stuff to its own module 2025-03-06 09:26:35 +01:00
Klaas van Schelven
4cde74d7cb Event search: first version 2025-03-04 13:51:56 +01:00
Klaas van Schelven
0cbdae9411 _get_events helper: clarify edge-cases
In b76e474ef1, the event-navigation was changed into the next/prev idiom (I
think completely, i.e. also from the .html files, but did not check) but the
elif structure and error message did not fully reflect that (it still talked
about digest_order/id, but nav is now one of the primary methods)

I briefly considered removing the lookup-by-digest-order-only, but I figure it
may come in handy at some point (if only for users to directly edit the url)
and did not check whether this is actually unused.
2025-03-04 09:59:03 +01:00
Klaas van Schelven
a00a815261 Merge branch 'main' into tag-search 2025-03-03 15:02:13 +01:00
Klaas van Schelven
5930740e0b Tags: as a separate tab 2025-03-03 12:56:20 +01:00
Klaas van Schelven
d5228f9932 Add 'level' to logentry event details 2025-02-27 15:26:10 +01:00
Klaas van Schelven
7a19e2d277 Tags; deducing tags; search on tags; WIP 2025-02-27 13:12:49 +01:00
Klaas van Schelven
4b7ed8f4ec Rename get_contexts_enriched_with_ua
more closely match what's going on
2025-02-26 18:20:52 +01:00
Klaas van Schelven
2cb87f8334 Issues list pagination 2025-02-18 09:47:30 +01:00
Klaas van Schelven
4c4d589f2b Fix on ac3badbdb1 2025-02-14 12:25:10 +01:00
Klaas van Schelven
6f4acf216e Show message.message in event details
Fix #43
2025-02-14 12:20:56 +01:00
Klaas van Schelven
ac3badbdb1 Logentry: show in event-details
it's useful info (and the now-removed comment was also untrue)
2025-02-14 11:35:38 +01:00
Klaas van Schelven
561c1d324a event.data getters
in preparation for scenarios where the dumped data is not stored in the DB
2025-02-07 17:09:36 +01:00
Klaas van Schelven
615d2da4c8 Chache stored_event_count (on Issue and Projet)
"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.
2025-02-06 16:24:25 +01:00
Klaas van Schelven
86e8c4318b Add indexes on fields on which we order and vice versa
Triggered by issue_event_list being more than 5s on "emu" (my 1,500,000 event
test-machine). Reason: sorting those events on non-indexed field. Switching
to a field-with-index solved it.

I then analysed (grepped) for "ordering" and "order_by" and set indexes
accordingly and more or less indiscriminately (i.e. even on tables that are
assumed to have relatively few rows, such as Project & Team).
2025-02-04 21:19:24 +01:00
Klaas van Schelven
3dec96509b Show event.grouping.grouping_key in the event details UI 2025-01-31 16:16:47 +01:00
Klaas van Schelven
102070bf24 Show transaction in the event details 2025-01-31 13:09:54 +01:00
Klaas van Schelven
d2f4be193f Comment about logentry.* in the event details 2025-01-31 13:03:13 +01:00
Klaas van Schelven
b57ccec4c6 Show 'handled' and 'mechanism' in the event details 2025-01-31 13:02:49 +01:00
Klaas van Schelven
a5bc27032a Visualize trimmed data ('x items trimmed')
Fix #18

Similar to [the request for the same feature in Sentry](https://github.com/getsentry/sentry/issues/68426)

SDK-side complaints:

* https://github.com/getsentry/sentry-python/issues/377
* https://github.com/getsentry/sentry-python/issues/805
* https://github.com/getsentry/sentry-python/issues/1041
* https://github.com/getsentry/sentry-python/issues/1105
* https://github.com/getsentry/sentry-python/issues/2121
* https://github.com/getsentry/sentry-python/issues/2682
* https://github.com/getsentry/sentry-python/issues/3209
* https://github.com/getsentry/sentry-python/issues/3634
* https://github.com/getsentry/sentry-python/issues/3740
2024-12-18 17:05:26 +01:00
Klaas van Schelven
c1a74542f2 Breadcrumbs can be w/o values too (see 2 prev. commits) 2024-12-16 11:24:20 +01:00
Klaas van Schelven
b597d91af7 Become robust for lack of .values key in exception
Fix #16
2024-12-16 11:22:32 +01:00
Klaas van Schelven
a899be8cd5 Order events on event_list page
Paginator's Warning inspired me to do so
2024-09-26 16:18:29 +02:00
Klaas van Schelven
336e126e3e Event-list: pagination 2024-09-26 10:39:36 +02:00
Klaas van Schelven
fd79706c54 Search (TSTTCPW approach) 2024-09-25 14:49:05 +02:00