← Back to Pull requests

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

Closed
unknown closed this pull request without merging on Nov 16, 2026 18:22 UTC
View on GitHub
unknown unknown commented on Nov 12, 2026 03:15 UTC
Author

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
  • Diff: 418 lines (+313 / -105) across 5 files Reviewer: fuzzybinary Review duration: 6666m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.45) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 418 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.361
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #336"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.0% (MEDIUM) · Higher = larger blast radius
    45.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.4% · Safe to merge
    19.4%