Closed
Description
Problem
In JS fetch()
basically runs through 3 stages:
fetch()
is called and startedfetch()
resolves - generally meaning status code and response headers are returned- The response body streams in (either one chunk or multiple chunks over time)
As of today, the spans we record for fetch calls only entail 1 and 2. Since the web is moving more and more towards streaming (LLMs, React Server Components, Server-Sent Events, ...), it would be quite important to also entail the response streams (3).
Solution Brainstorm
There different approaches we can take:
- Simply extend the spans to also wait for the response body.
Extend the span to wait for the response body, but attach a child span that tracks the duration until the first byte (entailing 1 and 2).(see comment)