request:end fires when the handler returns, not when a stream it produced finishes: a
route that returns an AsyncIterable is done here in milliseconds while its connection may
live for hours […] stream:open/stream:close already describe the connection, and now
carry the same requestId.
They do not. All three emitters send { name } and nothing else:
src/http/stream.ts:41,79,86 — the Node adapter
src/http/ws-core.ts:120,132,135 — the WebSocket path
src/http/web.ts — the Fetch adapter (added in #83, mirroring the two above)
Bus.emit (src/bus.ts:179) forwards the payload verbatim and adds nothing ambient, so there is
no other place the field could be arriving from.
Why the gap matters
The split of responsibilities is right: a request span that ended in 2ms and a connection that
lived for six hours must not share a latency distribution. But the split only works if the two
can be joined, and requestId is the join key — it is what EventPayload documents itself
as ("Correlates every event of one request").
Without it:
an exporter cannot attribute a stream to the route, tenant or trace that opened it, because name is the only field and it is just the pattern;
traceId, which is carried verbatim precisely so an exporter can hand it to OTLP, never
reaches the events describing the longest-lived thing the server does;
"which request opened the SSE connection that is still holding a slot" is unanswerable, which
is the question stream gauges exist to answer.
Scope
Thread Correlation to the three emitters the same way emitShedPair already receives it, and
spread it into the payload:
bus?.emit('stream:open',{name,...correlation});
pipeStream and asReadableStream both already take bus and name; this is one more argument
on each, and the callers (src/http/server.ts:181, outcomeToResponse in src/http/web.ts)
have correlation in hand at the call site. ws-core needs checking separately — an upgrade
correlates differently and may not have one to give.
Then fix or delete the claim in core.ts, which is currently the only place the intended
behaviour is written down.
Related
Found while implementing #83. Pre-existing: the field has never been emitted, so the comment
described an intent that was not carried out rather than a regression.
`src/http/core.ts` states the design as:
> `request:end` fires when the handler returns, **not** when a stream it produced finishes: a
> route that returns an `AsyncIterable` is done here in milliseconds while its connection may
> live for hours […] `stream:open`/`stream:close` already describe the connection, **and now
> carry the same `requestId`**.
They do not. All three emitters send `{ name }` and nothing else:
- `src/http/stream.ts:41,79,86` — the Node adapter
- `src/http/ws-core.ts:120,132,135` — the WebSocket path
- `src/http/web.ts` — the Fetch adapter (added in #83, mirroring the two above)
`Bus.emit` (`src/bus.ts:179`) forwards the payload verbatim and adds nothing ambient, so there is
no other place the field could be arriving from.
## Why the gap matters
The split of responsibilities is right: a request span that ended in 2ms and a connection that
lived for six hours must not share a latency distribution. But the split only works if the two
can be **joined**, and `requestId` is the join key — it is what `EventPayload` documents itself
as ("Correlates every event of one request").
Without it:
- an exporter cannot attribute a stream to the route, tenant or trace that opened it, because
`name` is the only field and it is just the pattern;
- `traceId`, which is carried verbatim precisely so an exporter can hand it to OTLP, never
reaches the events describing the longest-lived thing the server does;
- "which request opened the SSE connection that is still holding a slot" is unanswerable, which
is the question stream gauges exist to answer.
## Scope
Thread `Correlation` to the three emitters the same way `emitShedPair` already receives it, and
spread it into the payload:
```ts
bus?.emit('stream:open', { name, ...correlation });
```
`pipeStream` and `asReadableStream` both already take `bus` and `name`; this is one more argument
on each, and the callers (`src/http/server.ts:181`, `outcomeToResponse` in `src/http/web.ts`)
have `correlation` in hand at the call site. `ws-core` needs checking separately — an upgrade
correlates differently and may not have one to give.
Then fix or delete the claim in `core.ts`, which is currently the only place the intended
behaviour is written down.
## Related
Found while implementing #83. Pre-existing: the field has never been emitted, so the comment
described an intent that was not carried out rather than a regression.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
src/http/core.tsstates the design as:They do not. All three emitters send
{ name }and nothing else:src/http/stream.ts:41,79,86— the Node adaptersrc/http/ws-core.ts:120,132,135— the WebSocket pathsrc/http/web.ts— the Fetch adapter (added in #83, mirroring the two above)Bus.emit(src/bus.ts:179) forwards the payload verbatim and adds nothing ambient, so there isno other place the field could be arriving from.
Why the gap matters
The split of responsibilities is right: a request span that ended in 2ms and a connection that
lived for six hours must not share a latency distribution. But the split only works if the two
can be joined, and
requestIdis the join key — it is whatEventPayloaddocuments itselfas ("Correlates every event of one request").
Without it:
nameis the only field and it is just the pattern;traceId, which is carried verbatim precisely so an exporter can hand it to OTLP, neverreaches the events describing the longest-lived thing the server does;
is the question stream gauges exist to answer.
Scope
Thread
Correlationto the three emitters the same wayemitShedPairalready receives it, andspread it into the payload:
pipeStreamandasReadableStreamboth already takebusandname; this is one more argumenton each, and the callers (
src/http/server.ts:181,outcomeToResponseinsrc/http/web.ts)have
correlationin hand at the call site.ws-coreneeds checking separately — an upgradecorrelates differently and may not have one to give.
Then fix or delete the claim in
core.ts, which is currently the only place the intendedbehaviour is written down.
Related
Found while implementing #83. Pre-existing: the field has never been emitted, so the comment
described an intent that was not carried out rather than a regression.