39 Commits

Author SHA1 Message Date
Klaas van Schelven
28b2ce0eaf Various models: .project SET_NULL => DO_NOTHING
Like e45c61d6f0, but for .project.

I originally thought `SET_NULL` would be a good way to "do stuff later", but
that's only so the degree that [1] updates are cheaper than deletes and [2]
2nd-order effects (further deletes in the dep-tree) are avoided.

Now that we have explicit Project-deletion (deps-first, delayed, properly batched)
the SET_NULL behavior is always a no-op (but with cost in queries).

As a result, in the test for project deletion (which has deletes for many
of the altered models), the following 12 queries are no longer done:

```
SELECT "projects_project"."id", [..many fields..] FROM "projects_project" WHERE "projects_project"."id" = 1
DELETE FROM "projects_projectmembership" WHERE "projects_projectmembership"."project_id" IN (1)
DELETE FROM "alerts_messagingserviceconfig" WHERE "alerts_messagingserviceconfig"."project_id" IN (1)
UPDATE "releases_release" SET "project_id" = NULL WHERE "releases_release"."project_id" IN (1)
UPDATE "issues_issue" SET "project_id" = NULL WHERE "issues_issue"."project_id" IN (1)
UPDATE "issues_grouping" SET "project_id" = NULL WHERE "issues_grouping"."project_id" IN (1)
UPDATE "events_event" SET "project_id" = NULL WHERE "events_event"."project_id" IN (1)
UPDATE "tags_tagkey" SET "project_id" = NULL WHERE "tags_tagkey"."project_id" IN (1)
UPDATE "tags_tagvalue" SET "project_id" = NULL WHERE "tags_tagvalue"."project_id" IN (1)
UPDATE "tags_eventtag" SET "project_id" = NULL WHERE "tags_eventtag"."project_id" IN (1)
UPDATE "tags_issuetag" SET "project_id" = NULL WHERE "tags_issuetag"."project_id" IN (1)
```
2025-07-03 21:49:49 +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
6e0f1f0f54 Document team/project visibility/access design 2025-04-04 10:01:38 +02:00
Klaas van Schelven
8fc6f752cf Allow users to join their own team's projects
Fix #56

Looked into this for a while, but I think it was simply an oversight in
the logic-as-programmed; if you're part of a team, you should be able
to just click 'join' on any of that team's projects and be a project-member
2025-04-03 16:28:35 +02: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
59372aba33 First version of multi-tenant setup (EE) 2025-01-29 09:04:19 +01:00
Klaas van Schelven
cf4a1dbeb6 Project/team help_text 2024-11-20 14:33:04 +01:00
Klaas van Schelven
98e666e3ff Remove dashses from displayed DSN
Fixes #7

I could not find any documentation on what the "standard" is, but I know that
we'll pick it up just fine either way (because Django's UUID field does the
magic for us).

Given that it's impossible to setup your JS client with the dashes, they should
simply be removed.
2024-10-14 20:15:45 +02:00
Klaas van Schelven
8ee526776e Show 'no version' on a button when this applies 2024-09-30 21:22:34 +02:00
Klaas van Schelven
79c9413256 Remove TODO about indexing on Project (id, sentry_key)
This was probably about the making Project.objects.get(id, sentry_key)
more efficient, but

* I don't have an indication it's a bottleneck
* It may very well be turned into a get-by-id, check-for-key idiom,
  in which case the index won't help.
2024-09-13 10:03:20 +02:00
Klaas van Schelven
e59fd3a225 Implement 'occurs_in_last_release' 2024-09-12 09:49:22 +02:00
Klaas van Schelven
51a53c09a4 quota: check as little as possible & check-on-digest
Also fix various off-by-one errors with the help of tests
2024-07-17 14:48:19 +02:00
Klaas van Schelven
8849a3e44b Don't write to the DB on-ingest
In the previous commit I put the code for a small performance-experiment.
The results are (very) obvious: don't do this. Response times go through
the roof, and more importantly, the server becomes unreliable. Reason:
time-outs caused by waiting for the write-lock.
2024-07-16 16:39:12 +02:00
Klaas van Schelven
0c964cfcc8 Add project.ingested_event_count (input for performance-experiment) 2024-07-16 15:48:16 +02:00
Klaas van Schelven
fbee32c79a Remove some 'maybe' comments for 'drop immediately' 2024-07-15 11:02:08 +02:00
Klaas van Schelven
d68aff05ca Quota 2024-07-15 09:37:36 +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
228ef184e1 refactoring: class-definition order
should not matter but keeping the fields together is better
2024-06-20 09:21:55 +02:00
Klaas van Schelven
1171309b4e Project-list button-visibility fixed for auth 2024-06-17 11:06:41 +02:00
Klaas van Schelven
95cb39f5af Implement 'send_email_alerts'
* cascading from team to project; user is base-level-default
* implemented at form-level
* implemented when emails are actually sent
2024-06-13 13:23:14 +02:00
Klaas van Schelven
de8bd65a3a WIP teams & project-management (6)
not extensively tested, but it starts to feel quite complete 'for now'
2024-06-07 10:52:25 +02:00
Klaas van Schelven
9d9cac3e9d WIP teams & project-management 2024-06-03 22:30:10 +02:00
Klaas van Schelven
ee228a681d Project 'view on site' button 2024-05-16 10:36:55 +02:00
Klaas van Schelven
f2de61b273 Use app_settings for Bugsink-specific stuff
something about consistency
2024-05-13 15:09:35 +02:00
Klaas van Schelven
21c4904524 Implement friendly_id 2024-04-09 11:09:31 +02:00
Klaas van Schelven
9550c5f1dc Uniqueness constraint on (user, project) in ProjectMembership 2024-02-07 23:11:26 +01:00
Klaas van Schelven
901055938c Project-list in the menu: from DB rather than static nonsense 2024-01-16 23:14:56 +01:00
Klaas van Schelven
97d2e0b09d WIP: email-sending for new_issue 2024-01-14 22:25:36 +01:00
Klaas van Schelven
6bc00c366a no volume-based alerts (only volume-based muting) 2024-01-05 20:31:51 +01:00
Klaas van Schelven
89cab4f3c8 WIP: midway checkin in the PeriodCounter registry stuff 2024-01-05 20:20:14 +01:00
Klaas van Schelven
99ac06a0d8 Releases, events, issues: WIP 2023-12-14 19:57:06 +01:00
Klaas van Schelven
8c5d416447 DSN added to project admin 2023-11-19 17:27:29 +01:00
Klaas van Schelven
238fb6dda7 Event as a Django model (first version) 2023-11-11 12:33:37 +01:00
Klaas van Schelven
3ca27a43d5 First jab at ingesting loads of example data 2023-11-10 19:50:42 +01:00
Klaas van Schelven
66b30bb792 Actually connect events to the correct project when the header is provided 2023-11-09 23:49:52 +01:00
Klaas van Schelven
972fd99697 Issue model introduced and used 2023-11-05 17:43:05 +01:00
Klaas van Schelven
1e7ec4c1f4 Actually save something to the DB 2023-11-03 19:56:36 +01:00