Skip to content

Record response headers on http client spans #9643

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

Open
lforst opened this issue Nov 23, 2023 · 3 comments
Open

Record response headers on http client spans #9643

lforst opened this issue Nov 23, 2023 · 3 comments
Labels
Improvement Package: browser Issues related to the Sentry Browser SDK Spans

Comments

@lforst
Copy link
Contributor

lforst commented Nov 23, 2023

There are valid use cases where you would want to capture the response headers on an HTTP client span. E.g. when you don't control the backend so you can't instrument it.

Our current implementation doesn't allow for this. We should add functionality to capture HTTP response headers.

@mydea
Copy link
Member

mydea commented Nov 23, 2023

We have some code for this already for replay, we may be able to hoist this up somehow!

@estimmerman
Copy link

I wanted to bump this as we are currently running into a need for this!

We have automatic tracing implemented using the JavaScript SDK, and would like to be able to augment our spans with custom attributes based on response headers. Our use case is that we are making changes to our APIs to add an internal caching framework, and are sending metadata around cache hits via response headers. We'd like to be able to segment/analyze span duration in the Sentry UI based on this metadata to monitor pre/post performance changes.

This appears to basically be the response version of #15979, which was recently added.

As an alternative it seems we could wrap all of our requests in spans to manually instrument post-processing of spans (https://docs.sentry.io/platforms/javascript/tracing/instrumentation/requests-module/), but as far as I can tell this is entirely independent of tracing and would require us to roll our own behavior for things like sampling.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 2, 2025
Copy link
Contributor Author

lforst commented May 5, 2025

Thanks for raising your use case. It is indeed a bit tricky to do this yourself because we don't expose the spans for fetch requests in any way. This is still on our backlog and imo it makes definitely sense to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Package: browser Issues related to the Sentry Browser SDK Spans
Projects
Status: No status
Development

No branches or pull requests

5 participants