about summary refs log tree commit diff
path: root/src/usage.rs
AgeCommit message (Collapse)Author
4 daysusage: record what a request ran on, and put it in the access linePjotr Prins
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.