You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Include bytes sent/received in HTTP requests for replays #7373
The goal here is to get on the Replay blob request_body_size and response_body_size so we can understand how large these are.
We'll need to set some limits so it can also help answer the question: "Why don't I see my request body" or "why is it truncated"?
Additionally, it'll help us get a distribution of size and decide what these limits should be.
Note that Mobile SDKs add to breadcrumb.data the keys request_body_size and response_body_size to all breadcrumbs. This isn't on the develop docs it seems but possibly good value to breadcrumbs XHR/fetch on JS too outside of Replay
So just to clarify, we'll add this for all breadcrumbs, not just in replay itself. We'll add:
request_body_size
response_body_size
Which we get the same way as for replay recording length:
newTextEncoder().encode(recordingData).length
(Which is not supported in IE11, so we'll just not have this data there).
Final question: Should we do this for all requests/responses, or just for e.g. JSON? For responses we can probably look at content-type headers, for requests not so much (we can't access them).
I would propose one of these options, for simplicity:
Only capture it if we detect it to be a JSON string (starts with { and ends with }, or starts with [ and ends with ]), or form data (TBD how to detect this)
Always capture it from the text representation (not 100% sure but may be incorrect for non-text media types, I guess)
Final question: Should we do this for all requests/responses, or just for e.g. JSON? For responses we can probably look at content-type headers, for requests not so much (we can't access them).
Shouldn't we be able to access the request headers (at least for fetch?)
I would propose one of these options, for simplicity:
Only capture it if we detect it to be a JSON string (starts with { and ends with }, or starts with [ and ends with ]), or form data (TBD how to detect this)
Always capture it from the text representation (not 100% sure but may be incorrect for non-text media types, I guess)
I'd lean towards #2, but we should do some testing to see how inaccurate this can be.
changed the title [-]Include bytes sent/received in HTTP request breadcrumbs[/-][+]Include bytes sent/received in HTTP requests for replays[/+]on Mar 9, 2023
Activity
bruno-garcia commentedon Mar 7, 2023
FYI @krystofwoldrich outside of replays this would affect React Native and bring in on par to the other mobile SDKs if we're aligning.
mydea commentedon Mar 8, 2023
So just to clarify, we'll add this for all breadcrumbs, not just in replay itself. We'll add:
request_body_sizeresponse_body_sizeWhich we get the same way as for replay recording length:
(Which is not supported in IE11, so we'll just not have this data there).
Final question: Should we do this for all requests/responses, or just for e.g. JSON? For responses we can probably look at content-type headers, for requests not so much (we can't access them).
I would propose one of these options, for simplicity:
krystofwoldrich commentedon Mar 8, 2023
@bruno-garcia Thanks
@mydea RN doesn't have
TextEncodereither. If possible let's use theTextEncoderInternalabstraction so we can supply our own.billyvg commentedon Mar 8, 2023
Shouldn't we be able to access the request headers (at least for fetch?)
I'd lean towards #2, but we should do some testing to see how inaccurate this can be.
[-]Include bytes sent/received in HTTP requests[/-][+]Include bytes sent/received in HTTP request breadcrumbs[/+][-]Include bytes sent/received in HTTP request breadcrumbs[/-][+]Include bytes sent/received in HTTP requests for replays[/+]dprevost-LMI commentedon Nov 28, 2024
bytes or kb, bytes I assume?