Commit Graph

102 Commits

Author SHA1 Message Date
Klaas van Schelven
d7b46265d1 UA Agent Parsing should never crash the event-view
See #13
2024-11-15 10:55:16 +01:00
Klaas van Schelven
3222c0d85e Fix the tests (missing initial data in transactiontestcase) 2024-11-15 10:14:01 +01:00
Klaas van Schelven
c56611bc82 Note that MySQL supports DELETE w/ LIMIT too 2024-10-09 09:58:47 +02:00
Klaas van Schelven
f2a78fed9d Use the envelope's event_id when using the envelope endpoint
* As per the spec 'takes precendence'
* Also fixes the reported bug on Laravel, which apparently doesn't send event_id
  as part of the event payload.
* Fixes the envelope tests (they were doing nothing when I moved the
  data samples around recently)
* Adds a 'no event_id in data, but yes in envelope' test to that test.
* Adds handling to send_json such that we can send envelopes when the event_id
  is missing from the event data.
2024-09-18 11:36:47 +02:00
Klaas van Schelven
278630b529 Show Browser and OS info, and Contexts more generally 2024-09-16 16:55:34 +02:00
Klaas van Schelven
eec8d51491 Remove various non-TODOs
either already done, or more of a 'this is a way this code could potentially
evolve in the future' (but not a 'we must do this')
2024-09-13 10:05:22 +02:00
Klaas van Schelven
ff618099dc event-model TODOs: reorganize and reflect that these are not TODOs for now 2024-09-13 09:51:30 +02:00
Klaas van Schelven
1bfac5d8c6 assertEquals -> assertEual (Python 3.12)
<<insert remarks about fashion police>>
2024-08-21 08:49:49 +02:00
Klaas van Schelven
b76e474ef1 Navigation: fix for missing events
Now that we have eviction, events may disappear. Deal with it:

* event-specific 404 that still allows for navigation
* first/last buttons
* navigation to prev/next when prev/next is not just 1 step away
* don't use HttpRedirect for "lookup based" views
    in principle, the thing you were looking for might go missing in-between
    drawback: these URLs are not "stable"
2024-07-19 11:03:08 +02:00
Klaas van Schelven
3128392d9a Distinguish ingested_at and digested_at 2024-07-18 14:45:59 +02:00
Klaas van Schelven
c01d332e18 Rename ingest_order to digest_order and clarify event_count
* issue.event_count to digested_event_count
* event.ingest_order to event.digest_order
* issue.ingest_order to digest_order

This is generally more correct/explicit, and is also in preparation
of doing work on-digest (which may or may not happen)
2024-07-16 15:23:40 +02:00
Klaas van Schelven
93365f4c8d Period-counting using SQL instead of custom-made (PoC)
The direct cause for this was the following observation: there was no mechanism
in place to safeguard counted events across evictions, i.e. the following order
of events was not accounted for:

* ingest/digest a bunch of events (PCs correctly updated)
* eviction (PC still correct)
* server/snappea restart (PC reloaded, but based on new events. not correct).

I though about various approaches to fix this (e.g. snapshotting) but in the end
such approaches added even more complexity to the PC mechanism. I decided to first
check how non-performant the SQL route would be, and this PoC seems to say: just
go SQL.

There's also a small semantic change (probably in the direction of what you'd
expect), namely: the periods are no longer 'calendar' periods.
2024-07-15 14:28:13 +02:00
Klaas van Schelven
6a5521472a Eviction: notes on 'just-drop' saved 2024-07-08 10:52:26 +02:00
Klaas van Schelven
7d32f27f00 Close connection on MainThread that we open ourselves in the debug server 2024-07-05 10:36:25 +02:00
Klaas van Schelven
14302783aa Eviction: Age based irrelevance with a base of 4 2024-07-02 09:03:17 +02:00
Klaas van Schelven
b145ef6631 Eviction: 500 per-eviction is a hard-limit; even for lowered max-events 2024-07-01 15:02:39 +02:00
Klaas van Schelven
ec01a64651 Evictions: delete_with_limit (don't overshoot) 2024-07-01 14:07:10 +02:00
Klaas van Schelven
c5df10e9cf Stress test: ability to use multiple dsns (projects) 2024-06-27 09:52:10 +02:00
Klaas van Schelven
e9ed7835c1 eviction_target bugfix; delete 'never_evict' if nothing else remains 2024-06-26 11:06:04 +02:00
Klaas van Schelven
833ebfe9ac Move code around & document it 2024-06-26 10:11:59 +02:00
Klaas van Schelven
e4bad2c4f5 Fix existing tests (add field to factory call) 2024-06-26 10:03:25 +02:00
Klaas van Schelven
f45995ce19 Evinction lowered target: no more lowering than 500 (for large quota) 2024-06-26 09:53:16 +02:00
Klaas van Schelven
9a96ab767a retention insights: don't ignore never_evict=True 2024-06-26 09:38:34 +02:00
Klaas van Schelven
653739a8f6 Eviction: use deletion counts to keep track of the work
This saves a query in the (small) loop (namely: selection counts of remaining items)

It also allows us to stop sooner (evict less).
2024-06-26 09:26:34 +02:00
Klaas van Schelven
fe6c955465 never_evict events that are a Historic Turning Point
Both for technical (foreign keys) and business reasons (these are events you
care about)
2024-06-24 22:50:00 +02:00
Klaas van Schelven
adda019cef Add an index to the Event model for eviction
Unscientifically (n=1, changing circumstances), this improved times like so when the max was 10k:

* 573.56ms EVICT; down to 8813, max irr. from 15 to 13 in 171ms+402ms and 5+4 queries  (pre-index)
* 229.34ms EVICT; down to 7643, max irr. from 15 to 12 in 7ms+222ms and 5+7 queries    (post-index)

The order of the index was chosen because we have 3 types of queries in our algo:

* on Project -> irrelevance <= amount of work
* on Project, timestamp -> irrelevance <= observed irrelevances
* on Project, timestamp, irrelevance -> deletion
2024-06-24 14:29:01 +02:00
Klaas van Schelven
2bdc357a87 Eviction: logging 2024-06-24 13:58:45 +02:00
Klaas van Schelven
69a40480fd Retention/eviction: more small fixes/cleanup 2024-06-24 11:48:21 +02:00
Klaas van Schelven
bdc6193214 Add tool to generate insight in retention (and fix bugs that that insight revelead) 2024-06-24 10:59:04 +02:00
Klaas van Schelven
63afba020a Eviction: 95% 'lowered target' 2024-06-24 09:24:03 +02:00
Klaas van Schelven
82b229613b Fix: store generator in list b/c repeated evaluation 2024-06-24 09:12:07 +02:00
Klaas van Schelven
5e2cc0575f Retention, small fixes (from Friday) 2024-06-23 22:20:18 +02:00
Klaas van Schelven
ea6aa9bbca Retention/quotas: something that 'seems to work' (doesn't immediately crash) 2024-06-21 11:50:13 +02:00
Klaas van Schelven
c2b821589d Retention, WIP (yesterday) 2024-06-21 09:28:04 +02:00
Klaas van Schelven
f9330e05de Simulation: PoC for 'just drop (never accept)' 2024-06-19 11:00:22 +02:00
Klaas van Schelven
6259ed7c86 Simulator: minor improvements 2024-06-19 10:15:27 +02:00
Klaas van Schelven
5ca5b22dec Simulator: variable per-epoch how-many 2024-06-19 09:41:11 +02:00
Klaas van Schelven
4889c2b07b Eviction: off-by-one and naming 2024-06-18 22:43:21 +02:00
Klaas van Schelven
7e33a86c85 First steps with simulating retention/eviction 2024-06-18 20:52:56 +02:00
Klaas van Schelven
8ad6059722 Complete migration reset 2024-06-14 10:29:10 +02:00
Klaas van Schelven
c4358aaece Fix tests for users.User idiom 2024-06-12 17:45:06 +02:00
Klaas van Schelven
9f1be0b001 Document admin dead-end 2024-05-27 13:54:02 +02:00
Klaas van Schelven
8d23239526 Be more strict about usage of TransactionTestCase in tests 2024-04-27 20:35:35 +02:00
Klaas van Schelven
58435754e0 Digest immediately implemented 2024-04-26 14:48:07 +02:00
Klaas van Schelven
c50780ab4e Use atomic transactions in views 2024-04-18 13:15:46 +02:00
Klaas van Schelven
d89e3d4dd5 Add 'next-materialized historic annotation 2024-04-16 09:31:12 +02:00
Klaas van Schelven
2c4e8b9f20 Regular v.s. Django Testcase: be explicit
I recently ran into a funny issue where the TestCases were influencing my
development DB's contents
2024-04-15 09:17:53 +02:00
Klaas van Schelven
f098802fde Event already exists: return 400; implement with one less query 2024-04-11 11:03:41 +02:00
Klaas van Schelven
4dfefec468 denormalize/cache last_frame_* and transaction on Event and Issue
for performance, but also fixes:

* not just the 'last frame' but the 'last relevant frame' (in-app)
* truncation is properly done (matching the DB size, and for each of the fields)
2024-04-10 09:12:15 +02:00
Klaas van Schelven
ba6b158848 Fix on previous commit (wrong unique index) 2024-04-10 08:54:58 +02:00