Repository navigation
Commit b25ea43
refactor(server): instrument WS RPCs in the group middleware
Every WebSocket RPC handler wrapped its body in observeRpcEffect,
observeRpcStream or observeRpcStreamEffect to get its span and request
metrics, while the group middleware already did the scope check. Calls
the scope check rejected never reached a wrapper, so they were neither
traced nor counted.
The middleware, renamed WsRpcGuard, now does both: it checks the scope
and wraps the call, rejected or not, in the ws.rpc.<method> span and the
t3_rpc_requests_total / t3_rpc_request_duration metrics. Handlers are
plain service calls again. The rpc.aggregate labels move into an
exhaustive per-method map typed over WsRpcGroup, with every existing
value kept as is. Per-call attributes (thread, command, task, provider
instance ids) move into the handlers as Effect.annotateCurrentSpan.
For stream RPCs the middleware wraps the server's stream runner, so the
span and the duration cover the subscription until it ends, fails or is
interrupted. The tracing opt-outs for the diagnostics RPCs are unchanged.
deviceList keeps its input-dependent check in the handler.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>1 parent f870c41 commit b25ea43
10 files changed
Lines changed: 1418 additions & 2003 deletions
File tree
- apps/server/src
- auth
- mcp
- observability
- docs
- internals
- operations
- packages/contracts/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
222 | 224 | | |
223 | 225 | | |
224 | 226 | | |
225 | | - | |
226 | | - | |
227 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
228 | 233 | | |
229 | | - | |
230 | | - | |
231 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
232 | 238 | | |
233 | 239 | | |
234 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
1262 | 1262 | | |
1263 | 1263 | | |
1264 | 1264 | | |
1265 | | - | |
| 1265 | + | |
1266 | 1266 | | |
1267 | 1267 | | |
1268 | 1268 | | |
| |||
0 commit comments