Skip to content

Commit 23c8a2b

Browse files
authored
Middleware and metric to track per-database HTTP response egress (#5611)
# Description of Changes This commit adds a new Prometheus metric, `spacetime_http_response_size_bytes_total`, which tracks bytes sent as responses to HTTP requests related to the database. This includes the `sql` and `call` routes, guest-defined HTTP handlers, logs, plus some misc. management routes. Notably, the `subscribe` route, which initiates a long-lived WebSocket connection, is not counted by the new metric, as we already track its egress separately. The new metric is tracked by an Axum middleware. # API and ABI breaking changes N/a # Expected complexity level and risk 1 or 2? I don't have a huge amount of confidence any time I touch our Axum stuff, but this is just metrics, and (at least currently) not billed metrics. # Testing - [x] New unit tests which assert that the middleware functions correctly when used with a mocked router. - [ ] I don't know how to integration-test metrics.
1 parent 36879b8 commit 23c8a2b

5 files changed

Lines changed: 609 additions & 196 deletions

File tree

0 commit comments

Comments
 (0)