Skip to content

Conversation

@agrognetti
Copy link
Contributor

@agrognetti agrognetti commented Jan 15, 2026

Summary

Replaces try/catch-based error handling in SessionReplayApiService with a throwOnErrors helper that throws a custom exception on GraphQL errors. Refactors SessionReplayEventGenerator to support state snapshot/restore for reliable retries, and updates SessionReplayExporter to snapshot and restore state on failure, ensuring event and payload ID consistency. Also improves naming and documentation for clarity.


Note

Improves reliability and observability of replay and sampling flows by adding structured logging, centralized GraphQL error handling, and resilient state management with rollback on failures.

  • GraphQLClient: accepts LDLogger; logs GraphQL errors via logErrors; all call sites (e.g., InstrumentationManager, SessionReplayExporter) pass the logger
  • Sampling: SamplingApiService minor cleanup (const path, remove local error printing)
  • Replay API: replace try/catch logging with throwOnErrors(...) and a SessionReplayApiException; all operations now surface GraphQL errors
  • Event generation: SessionReplayEventGenerator adds sid/canvas state snapshot/restore (getState/restoreState), renames fields for clarity
  • Exporter: SessionReplayExporter now takes a logger, snapshots and restores internal state on exceptions (including payload IDs and generator state) for consistent retries; logs identify failures; minor naming tidy-ups
  • Replay instrumentation: wires logger into SessionReplayExporter
  • Tests: updated to accommodate logger in GraphQLClient/SessionReplayExporter and new behaviors

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

Replaces try/catch-based error handling in SessionReplayApiService with a throwOnErrors helper that throws a custom exception on GraphQL errors.
Refactors SessionReplayEventGenerator to support state snapshot/restore for reliable retries, and updates SessionReplayExporter to snapshot and restore state on failure, ensuring event and payload ID consistency.
Also improves naming and documentation for clarity.
@agrognetti agrognetti requested a review from a team as a code owner January 15, 2026 20:27
Copy link
Contributor

@abelonogov-ld abelonogov-ld left a comment

Choose a reason for hiding this comment

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

Nice it also fixes offline

Replaces direct printing and Android Log calls with structured logging using LDLogger in GraphQLClient and SessionReplayExporter.
GraphQLClient now logs errors internally, and logger is injected into relevant classes. Updates tests and constructors to support logger injection, and removes redundant error printing methods.
@agrognetti agrognetti merged commit b6e8084 into main Jan 16, 2026
24 checks passed
@agrognetti agrognetti deleted the agrognetti/O11Y-957 branch January 16, 2026 20:14
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.

3 participants