Commit Graph

192 Commits

Author SHA1 Message Date
Klaas van Schelven
4a28c51b6a Tests: Add known-broken handling for events that are invalid on purpose 2024-11-15 11:20:12 +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
0f60dab032 phone-home: on (docker) server-start too 2024-11-11 14:37:27 +01:00
Klaas van Schelven
488b52ea04 prestart command (simplying the throwaway Docker install) 2024-11-06 09:38:54 +01:00
Klaas van Schelven
1755fa32c0 Envelope parsing: push exception about lack of errors up into parser
fail-fast, rather than return-none-fail-later
2024-10-14 16:15:45 +02:00
Klaas van Schelven
1ca7a1ecd9 Envelope-parser parameter rename for clarity
the error is about whether an EOF can happen _right after_ the
header is parsed.
2024-10-14 11:34:11 +02:00
Klaas van Schelven
782bb81b82 Envelope is not actually json; let's reflect that in the filename 2024-10-09 09:38:00 +02:00
Klaas van Schelven
cba2eb3584 Envelope-store logging: point to exact location for download 2024-10-09 09:36:17 +02:00
Klaas van Schelven
55e077e974 Document a finding 2024-10-08 22:09:26 +02:00
Klaas van Schelven
98776ebdfb Storing of envelopes: added as a debugging tool 2024-10-08 13:19:07 +02:00
Klaas van Schelven
0e48f346d1 Avoid cross-transaction pollution
in IMMEDIATE mode, project was passed from an (implicit) read transaction to
the immediate_atomic-wrapped code; this meant that it was possible to miscount
project.digested_event_count
2024-10-08 11:53:31 +02:00
Klaas van Schelven
f0006a63f5 raise_exception helper: tag should be string
> Tags are key/value string pairs that are both indexed and searchable.
2024-10-08 11:00:57 +02:00
Klaas van Schelven
5e5b53abed Remove a false comment
(groupings do imply issues, it's a FK)
2024-09-27 18:14:51 +02:00
Klaas van Schelven
c50ae7afe7 Pin sample to test
on github.com the glob evaluated such that the sample could not be
modified according to the test-setup
2024-09-19 15:01:07 +02:00
Klaas van Schelven
b2b63c9664 Use precompiled event_schema.py 2024-09-19 14:57:47 +02:00
Klaas van Schelven
8f0985cbe5 fastjsonschema: don't touch my data please!
I'm sure this can be useful, but since I validate before storing, this is just
a ReallyBadIdea(TM). For one, it makes it so that running with different settings
of VALIDATE_ON_DIGEST leads to different data in the DB
2024-09-19 13:46:13 +02:00
Klaas van Schelven
096d1f7d9a Add 'samples' tests as such explicitly 2024-09-19 13:10:13 +02:00
Klaas van Schelven
9fa5d97d04 VALIDATE_ON_DIGEST rename (is more precise) 2024-09-19 13:09:59 +02:00
Klaas van Schelven
ff37e8f40c Remove 'understandable_json_errors utils
turns out it already exists (best_match)
2024-09-19 12:39:06 +02:00
Klaas van Schelven
febbbc67c7 Use fastjsonschema for validation 2024-09-19 12:17:41 +02:00
Klaas van Schelven
d0eb6bea95 Validation: ignore the '_meta' property
we've observed that this is sent-in-practice. we don't want to
actually remove it from the stored data, so we remove it only
from the thing we validate (not the actual data)
2024-09-19 11:20:08 +02:00
Klaas van Schelven
fe9aba5c7d Add (optional) input validation using JSONSchema 2024-09-19 10:14:00 +02:00
Klaas van Schelven
618e4c43b2 Don't 'manually revert' on failure, this is what we have transactions for
and in fact doing a manual revert leads to a TransactionManagementError
2024-09-19 09:23:10 +02:00
Klaas van Schelven
9eed504474 test: raise exception when invalid data is present 2024-09-19 09:21:15 +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
f4bbf0c386 Rewrite comment for understanding 2024-09-18 10:24:44 +02:00
Klaas van Schelven
8b7a8dbac5 Clarify a comment 2024-09-18 10:11:00 +02:00
Klaas van Schelven
1b6d17c947 Fix: when the first event of a new release is a regression, detect it
not detecting it was caused by incongruency between in-memory and serialized states of the data
2024-09-18 09:08:59 +02:00
Klaas van Schelven
c99702d046 Comment about why a patch function is used 2024-09-18 08:55:17 +02:00
Klaas van Schelven
c5465f2f8a Don't assume samples miss the 'timestamp' property
(we have fixed the samples accordingly)
2024-09-17 09:38:08 +02:00
Klaas van Schelven
937ffea15c Remove last remaining sample
we do this with the separate project now... the last remaining one
wasn't special enough to preserve
2024-09-16 14:39:44 +02:00
Klaas van Schelven
5f29a20765 send_json: print understandable json errors
at least: this works in the current set of circumstances
2024-09-16 14:20:21 +02:00
Klaas van Schelven
f1b75aab81 api.json.schema: put back in code, make test fail on invalidness and related fixes
This reverts course on 4201fbd778, and restores event.schema.json from that
commit.  In that commit we said: 'this is not used'. Not true: it's used in a
test, though this test used the validity check to silently skip.

In this commit:

1. Do _not_ just silently skip invalid samples. Since we have a way of properly
   validating, let's use that so that we know how useful the samples that we have
   actually are.

2. Deal with "_meta", a field that we sometimes see in the "private samples" (data
   that ultimately comes from running a somewhat recent python-sdk against my
   actual codebase). The need for this was exposed by [1]

3. Add a test for the up-to-date-ness of event.json.schema

4. remove special-cased attribute-checks in `is_valid`; `send_json` was, at the
   time, an opportunistic way to just get my hands on some sample data. the
   approach at validation reflected that: I just did some tests on the existence
   of certain attributes to determine which json files were even events. But in
   the end I did a full validation using an API schema, which kinda made the
   whole business useless. This commit cleans up the individual checks.
2024-09-16 11:28:05 +02:00
Klaas van Schelven
4201fbd778 remove vendored event.schema.json from codebase, document where it can be found in the future 2024-09-13 17:47:25 +02:00
Klaas van Schelven
497fbacb03 Remove event-samples from codebase
Properly sourced and licensed they are now at https://github.com/bugsink/event-samples
2024-09-13 11:11:12 +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
2e70197825 Add check_migrations command
this way, at least in the Docker setup, you'll get a meaningful error when you
try to start up a half-baked server
2024-09-09 15:31:14 +02:00
Klaas van Schelven
6bb853cd22 Comments about sqlite: take mysql into account too 2024-08-28 15:40:06 +02:00
Klaas van Schelven
129a8db421 Fix various flake8 errors 2024-08-21 09:31:05 +02:00
Klaas van Schelven
f7972cbec0 use datetime.timezone.utc
RemovedInDjango50Warning: The django.utils.timezone.utc alias is deprecated. Please update your code to use datetime.timezone.utc instead.
2024-08-21 09:01:20 +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
3128392d9a Distinguish ingested_at and digested_at 2024-07-18 14:45:59 +02:00
Klaas van Schelven
717a632b7d check_for_thresholds refactoring: 'metadata' is superfluous
because it was basically the input-tuple (in a different format)
2024-07-18 09:43:37 +02:00
Klaas van Schelven
b211ba4c1e Document possible way forward for counting all ingested events 2024-07-18 09:21:59 +02:00
Klaas van Schelven
f48c48f7e5 Implement 429 for the deprecated 'store' endpoint too 2024-07-18 09:19:37 +02:00
Klaas van Schelven
927587c132 Stress test interuptible, still show results 2024-07-17 17:33:30 +02:00
Klaas van Schelven
ec0877edb7 Document yet another problem with 'real streaming' and Nginx 2024-07-17 17:13:30 +02:00
Klaas van Schelven
65ea181f37 vbc-unmute: reduce calls to the expensive check
as done in the previous commit for project quota
2024-07-17 15:33:15 +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