Skip to content

fix: improve network response capture#379

Merged
Vadman97 merged 14 commits intomainfrom
vadim/fix-sdk-race
Feb 26, 2026
Merged

fix: improve network response capture#379
Vadman97 merged 14 commits intomainfrom
vadim/fix-sdk-race

Conversation

@Vadman97
Copy link
Contributor

@Vadman97 Vadman97 commented Feb 19, 2026

Summary

Improve capture of HTTP response bodies for long-running requests.
Fix requestResponseSanitizer logic not working correctly with OTel code.

How did you test this change?

local SDK build with example app
image

testing sanitizer
image
image

Are there any deployment considerations?


Note

Medium Risk
Touches the browser OTel span lifecycle/export path and adds async coordination for response-body capture, which could affect span export timing and memory usage under load.

Overview
Fixes fetch span response-body capture by coordinating the async Response body clone/read with span export: applyCustomAttributesOnSpan stores a per-span promise in pendingResponseAttributes, and CustomBatchSpanProcessor.onEnd() awaits it (and now also flushes/cleans up on shutdown/forceFlush).

Adds applyRequestResponseSanitizer for the OTel path and runs it for both fetch and XHR spans (before and after response attributes are added), including honoring a null return by marking spans with highlight.record=false and skipping body capture to avoid leaks.

Expands the React Router e2e http-test page with new response-body capture and high-concurrency/memory-pressure test buttons, and reformats .vscode/JSON config files in the mobile .NET sample.

Written by Cursor Bugbot for commit 78541bc. This will update automatically on new commits. Configure here.

@Vadman97 Vadman97 marked this pull request as ready for review February 19, 2026 07:23
@Vadman97 Vadman97 requested a review from a team as a code owner February 19, 2026 07:23
Copy link
Contributor

@ccschmitz-launchdarkly ccschmitz-launchdarkly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this! One thought on the design of this and trying to avoid calling these internal methods, but I like the approach overall and think this is a great improvement!

@ccschmitz-launchdarkly
Copy link
Contributor

Some relevant discussion around this functionality in the instrumentation-fetch repo: open-telemetry/opentelemetry-js#5293

Apparently they used to support this, but eliminated it because of potential memory pressure: open-telemetry/opentelemetry-js#5281

@Vadman97
Copy link
Contributor Author

another round of testing - seems good. validated it's not causing memory pressure
image

image

@Vadman97 Vadman97 enabled auto-merge (squash) February 26, 2026 01:24
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@Vadman97 Vadman97 merged commit 43d2dc3 into main Feb 26, 2026
22 checks passed
@Vadman97 Vadman97 deleted the vadim/fix-sdk-race branch February 26, 2026 17:41
Vadman97 pushed a commit that referenced this pull request Feb 26, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>observability: 1.0.3</summary>

##
[1.0.3](observability-1.0.2...observability-1.0.3)
(2026-02-26)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * highlight.run bumped to 9.27.1
</details>

<details><summary>session-replay: 1.0.3</summary>

##
[1.0.3](session-replay-1.0.2...session-replay-1.0.3)
(2026-02-26)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * highlight.run bumped to 9.27.1
</details>

<details><summary>highlight.run: 9.27.1</summary>

##
[9.27.1](highlight.run-9.27.0...highlight.run-9.27.1)
(2026-02-26)


### Bug Fixes

* improve network response capture
([#379](#379))
([43d2dc3](43d2dc3))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk release bookkeeping: version bumps and changelog updates
only, with no functional code changes in this diff.
> 
> **Overview**
> Updates release metadata to publish new patch versions:
`@launchdarkly/observability` and `@launchdarkly/session-replay` to
`1.0.3`, and `highlight.run` to `9.27.1`.
> 
> Changelogs are updated to reflect the dependency bump (and
`highlight.run`’s noted bug fix: improved network response capture), and
`.release-please-manifest.json` is updated accordingly.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c5cdc12. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
abelonogov-ld added a commit that referenced this pull request Feb 27, 2026
* main:
  chore: release main (#396)
  fix: Android span e2e tests (#397)
  fix: improve network response capture (#379)
  feat: initial upload of mobile-dotnet (#393)
  chore: release main (#394)
  fix: Fix event sorting in session replay export (#392)
  fix: Touch move event buffering using wrong clock and mismatched constants (#391)
abelonogov-ld added a commit that referenced this pull request Feb 28, 2026
* main:
  feat: Optional Jet Compose (#402)
  feat: Android Incremental Image Diff compression (#390)
  chore: add CLAUDE.md (#398)
  chore: release main (#400)
  fix: correct react native session replay build step (#399)
  chore: release main (#396)
  fix: Android span e2e tests (#397)
  fix: improve network response capture (#379)

# Conflicts:
#	sdk/@launchdarkly/mobile-dotnet/.vscode/tasks.json
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.

2 participants