-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make spans for fetch()
more accurate
#12640
Comments
@AbhiPrasad would love to hear your thoughts on having 2 spans, one for total duration, one for time to first byte (not the web vital lol). Would this have downstream implications? I remember the the Java SDK does something similar tracking things like tcp handshake and so on. |
two spans seems fine to me! only thing that comes to mind with two spans is which span should the |
Could span attributes be an alternative to emitting more spans? |
Yes that makes absolute sense. We should do it like this. |
Leaving here the Java PR for reference, in case there are keys we can align on: getsentry/sentry-java#3556 |
Problem
In JS
fetch()
basically runs through 3 stages:fetch()
is called and startedfetch()
resolves - generally meaning status code and response headers are returnedAs 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:
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)The text was updated successfully, but these errors were encountered: