Skip to content

RUM-18764: refactor(rum)!: use Browser SDK start/stop Resource APIs on WebGL - #336

Merged
abrooksv merged 5 commits into
developfrom
abrooks/webgl-resource-lifecycle
Nov 16, 2026
Merged

abrooksv merged 5 commits into
developfrom
abrooks/webgl-resource-lifecycle

Conversation

@abrooksv

@abrooksv abrooksv commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

What and why?

Use Browser SDK startResource / stopResource to time successful manual WebGL resources and build their events. Replace ResourceTracker with a small map retaining the method, URL, and start attributes needed to report network errors. Remove the unused resource event DTOs and build stop options as JSON in C# to omit absent status, size, and context.

Add dedicated direct API tests for two keys sharing a URL and completing in reverse order, start dates, nanosecond durations beyond Int32, method/type/status/size, and attribute merging. On failure, WebGL expects a resource event plus a network error; mobile expects only the network error.

Fix the worker proxy's StopResourceWithError(key, errorType, errorMessage, attributes) overload to forward attributes to the ErrorInfo overload. Previously, attributes supplied through this string overload were silently dropped on every platform.

The error-date assertion expects failure time. It is gated off on Android, with a TODO to remove the gate once the SDK pin includes Android PR #4151 (RUM-19988). The test waits 250 ms before reporting failure so a request-start timestamp falls outside the assertion's tolerance.

Breaking: failed manual WebGL resources now emit a resource event as well as the network error. Remove deprecated StopResource(key, Exception, attributes) (use StopResourceWithError), the public WebGL ResourceTracker helper, and the DatadogWebGLRum(IDateProvider) constructor.

Comparison with Flutter Web

The successful-resource approach follows Flutter #957.

  • Like Flutter Web, Unity WebGL calls stopResource before reporting the network error through the plugin's addEvent. This releases Browser SDK tracking and emits both a resource event and a network error. Mobile SDKs keep their error-only behavior.
  • Unity's error includes start and stop attributes, with stop values taking precedence, matching the mobile SDKs. Flutter Web's separate error receives only stop attributes.

Comparison with develop

Ran the copied resource tests and long-duration decoder on isolated develop at 3922872, with temporary trace assertions and payload capture. No develop SDK changes.

Check develop This branch
Resource date Completion time Request start
Events for a failed manual resource Error only Resource + error on WebGL
Method/type/status/size/duration Correct Unchanged
Stop attributes (string error overload) Dropped Forwarded
Manual trace/span/rule_psr location dd (wrong key) context

Neither captured WebGL version populates the expected _dd.trace_id, _dd.span_id, or _dd.rule_psr fields. Trace, span, sampling-rate, and context-removal assertions are enabled on Android and iOS. They are gated only on WebGL, with a TODO to follow up with Browser SDK; Unity's previous dd versus _dd mapping was already malformed, so I did not replicate it.

Review checklist

  • This pull request has appropriate unit and / or integration tests

@abrooksv
abrooksv force-pushed the abrooks/webgl-resource-lifecycle branch 2 times, most recently from 0f2769e to bd878d1 Compare November 12, 2026 18:17
@abrooksv abrooksv changed the title refactor(rum)!: use Browser SDK resource APIs on WebGL refactor(rum)!: use Browser SDK start/stop Resource APIs on WebGL Nov 12, 2026
@abrooksv
abrooksv marked this pull request as ready for review November 12, 2026 19:52
@abrooksv
abrooksv requested a review from a team as a code owner November 12, 2026 19:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T18:28:26.087594Z 2f8cdf3 New commits
🔒 Security Review ✅ Completed 2026-11-13T18:31:01.276752Z 2f8cdf3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd878d1bbc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

Failed manual WebGL resources leave their Browser SDK tracking state and start attributes retained until key reuse or session renewal, allowing memory to accumulate during repeated failures.

Open Bits AI session

🤖 Bits Code Review · Commit bd878d1

Let Browser SDK time and assemble manual resources. Close failed WebGL
resources before emitting a separate network error, matching Flutter Web
and releasing the Browser SDK tracking entry. Keep start information for
error attributes and serialize optional stop options in C#.

Forward stop attributes through the worker's string error overload and
remove the obsolete WebGL resource DTOs. Add direct lifecycle coverage
for overlapping keys, event dates, long durations, and attribute merging.
Gate WebGL trace checks and Android failure-time checks pending SDK fixes.

BREAKING CHANGE: Remove the deprecated StopResource overload accepting
an Exception; use StopResourceWithError instead. Remove the WebGL
ResourceTracker helper and DatadogWebGLRum date-provider constructor.
Failed manual WebGL resources now emit a resource event as well as a
network error event; Android and iOS keep their error-only behavior.
@abrooksv
abrooksv force-pushed the abrooks/webgl-resource-lifecycle branch from bd878d1 to 29fa4a2 Compare November 12, 2026 20:40

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

The WebGL bridge passed JavaScript syntax validation. Unity unit and player integration behavior remains unverified because the Unity toolchain is unavailable.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 29fa4a2

@abrooksv abrooksv changed the title refactor(rum)!: use Browser SDK start/stop Resource APIs on WebGL RUM-18764: refactor(rum)!: use Browser SDK start/stop Resource APIs on WebGL Nov 12, 2026

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

The PR adopts Browser SDK resource lifecycles on WebGL, forwards error attributes, and emits both resource and network-error events for failures. The latest commit avoids mutating caller dictionaries but introduces the sole open finding: a duplicate attributesJson declaration blocking WebGL compilation; Unity runtime validation remains unavailable.

Open Bits AI session

🤖 Bits Code Review · Commit 20e826e

Co-authored-by: romanG <158156364+rgaignault@users.noreply.github.com>
@abrooksv
abrooksv force-pushed the abrooks/webgl-resource-lifecycle branch from 20e826e to 7dd1624 Compare November 13, 2026 16:02

@datadog-prod-us1-3 datadog-prod-us1-3 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

Browser SDK lifecycle forwarding passed the specialist’s mocked bridge checks, with no reportable defects identified. Full Unity integration behavior remains unverified because Unity is unavailable.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 7dd1624

@abrooksv
abrooksv requested a review from rgaignault November 13, 2026 18:00
@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Pipelines

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: fac28ee | Docs | View more details | Give us feedback!

@abrooksv
abrooksv requested a review from fuzzybinary November 16, 2026 16:33
@abrooksv
abrooksv merged commit 8e2cae8 into develop Nov 16, 2026
11 checks passed
@abrooksv
abrooksv deleted the abrooks/webgl-resource-lifecycle branch November 16, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants