getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.84k stars 1.54k forks source link

Add protocol metadata to resource fetch requests #12395

Open serglom21 opened 2 months ago

serglom21 commented 2 months ago

Problem Statement

Currently, information like network.protocol.name and network.protocol.version is added to http.client operations. It would be beneficial to also see this information on resource fetch requests

Solution Brainstorm

Add network.protocol.name and network.protocol.version to resource fetch requests

Lms24 commented 2 months ago

Hey @serglom21 thanks for writing in!

It would be beneficial to also see this information on resource fetch requests

To confirm, do you mean the browser resource.(script|img|other) spans? image

I'm not sure this is possible given that the instrumentation for fetch and XHR requests (http.client spans) is different from how we create the resource spans. Gonna tag @k-fish since I believe you worked on adding the http timing data. Any idea if we can obtain this data for resource spans?

Which SDK are you using?

AbhiPrasad commented 2 months ago

Yes we can add this because it comes from the resource timing api: https://github.com/getsentry/sentry-javascript/blob/c8e9f84d9dbe8b81b04a3eb849a43112eee48af6/packages/browser/src/tracing/request.ts#L219

serglom21 commented 2 months ago

@Lms24 Correct! I mean all of the resource.(script|img|other) spans

This was tested on sentry.javascript.react@7.69.0

k-fish commented 2 months ago

Ditto what @AbhiPrasad said, it's definitely possible to get that out since it's part of resource timing.