BoxExpress
How requests and errors are recorded in a BoxExpress app.
A BoxExpress request never fires the runtime's request events, so bx-monitor listens to the lifecycle events BoxExpress announces from 0.2.31 on: onExpressRequestEnd and onExpressError. Nothing needs configuring: install both modules and set collectorUrl.
On an older BoxExpress the server still registers and sends heartbeats, without request stats or automatic error capture.
Requests
- A request is named by its route pattern (
GET /feeds/:id), never its path, so ids don't multiply routes. - One that matched no route (a
404, a static file, a rate-limit429) isGET <unmatched>. - The duration is the one BoxExpress measured, the same figure as its access log.
- A request counts as an error when the status sent is 500 or above.
- WebSocket upgrades and messages announce no request events, so they aren't counted.
Errors
Every error BoxExpress announces is captured, including one your error handler turns into a tidy 404; the request itself is still counted by its status.
An error raised after the response went out (a client that hung up mid-download arrives this way) has responseSent: true in its context.
Shutdown
A BoxExpress app stopped with SIGTERM doesn't unload its modules, so a JVM shutdown hook sends the goodbye instead. The collector shows the server as stopped, not lost.
Verified
scripts/e2e-boxexpress.sh in the repository runs a BoxExpress app against the stub collector on boxlang-express 0.2.32 and checks that requests arrive under their route pattern, concurrent ones are all counted, thrown errors arrive redacted, and SIGTERM sends the goodbye.