Skip to content

Instrument HTTP request end-to-end#211

Open
aron wants to merge 1 commit intoevanderkoogh:mainfrom
replicate:instrument-fetch-end-to-end-root
Open

Instrument HTTP request end-to-end#211
aron wants to merge 1 commit intoevanderkoogh:mainfrom
replicate:instrument-fetch-end-to-end-root

Conversation

@aron
Copy link

@aron aron commented Oct 6, 2025

What this PR solves / how to test:

Currently the span associated with a fetch() HTTP request is closed once the headers have been received and the promise resolves with a Response object. However this does not account for the time taken to stream the response body back to the client resulting in an inconsistent span.

This commit extends the current span to include the transfer of the HTTP response body rather than ending it when the headers complete. This provides a fuller, more accurate picture of the HTTP request.

This is implemented using a TransformStream on the HTTP response body that acts as a pass-through and only calling span.end() once the stream has completed.

This commit extends the current span to include the transfer of the
HTTP response body rather than ending it when the headers complete. This
provides a fuller, more accurate picture of the HTTP request.

This is implemented using a `TransformStream` on the HTTP response body
that acts as a pass-through and only calling `span.end()` once the
stream has completed.
@aron aron force-pushed the instrument-fetch-end-to-end-root branch from f88ff38 to 11bca7d Compare October 6, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant