about summary refs log tree commit diff
path: root/src/json_errors.rs
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-11-27 10:41:36 +0000
committerPjotr Prins <pjotr.public01@thebird.nl>2026-11-27 10:41:36 +0000
commit769782d921ea1229e9a67ef173eab569f564c73f (patch)
treeacd65e09773b505602d231b8dddca7168b450bfd /src/json_errors.rs
parent801c0b7c48b524d7d4289f1378f3a4b9832b3616 (diff)
downloadgenenetwork4-769782d921ea1229e9a67ef173eab569f564c73f.tar.gz
usage: record what a request ran on, and put it in the access line
The line was built by middleware that never sees a body, so on /compute/*
it named the endpoint but not the data: 706 compute requests in the week
to 2026-11-27, and the dataset could only be guessed from whatever the
same user had read a minute earlier (29% of them resolved to a dataset,
61% only to a group, 20% to a visit over half an hour old).

So a handler that knows the answer says it. `usage!(ctx, dataset = ...,
engine = ...)` writes into a per-request slot that tag_caller opens before
routing and merges in after the handler -- the CallerSlot pattern, down to
the Arc, which matters because compute clones its Ctx for the fallback
path and both handles must land in the one line.

Values are JSON, not text: hits stays a number and cached a bool, and a
string is bounded at 200 characters on a boundary, because `q` on /search
is caller text. RESERVED keeps a handler from overwriting the line's own
fields, and TRACKED lists the handlers that must report, with a test that
reads each route file so one edited later cannot silently go dark.

Not every route, deliberately: a read route already carries its dataset
in the path, so instrumenting it would only duplicate the path into the
line. The tracked set is the compute family plus /search.
Diffstat (limited to 'src/json_errors.rs')
0 files changed, 0 insertions, 0 deletions