Skip to content

Upgrade to Sentry 9.22, add Web View + OTLP journeys, enable Web & macOS#23

Merged
Prithvirajkumar merged 2 commits into
mainfrom
feature/sdk-9.22-webview-otlp-web-macos
Jun 19, 2026
Merged

Upgrade to Sentry 9.22, add Web View + OTLP journeys, enable Web & macOS#23
Prithvirajkumar merged 2 commits into
mainfrom
feature/sdk-9.22-webview-otlp-web-macos

Conversation

@Prithvirajkumar

@Prithvirajkumar Prithvirajkumar commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Brings the Empower Plant Flutter demo up to the latest Sentry SDK (9.22.0) and meaningfully broadens its platform and feature coverage:

  • Web View journey that demonstrates Flutter → web distributed tracing into the Empower Plant React app.
  • OTLP journey that routes the app's backend calls to the OpenTelemetry-instrumented backend.
  • Web and macOS builds now work (the code is made web-safe and macOS gets the network entitlement).
  • Build/tooling improvements (AGP bump, a distribute command for Sentry Build Distribution, source-map path fix).
  • Several UX fixes (real cart prices, product-grid layout on wide screens, clearer interaction spans).

All docs (README, CLAUDE, BUILD_GUIDE, SENTRY_FEATURES, SIZE_ANALYSIS_GUIDE) are updated to match.


Sentry SDK upgrade

  • sentry_flutter / sentry_dio / sentry_file / sentry_logging: 9.14.0 → 9.22.0
  • sentry_dart_plugin: 3.1.0 → 3.4.0
  • App version:9.22.0+1 (still matches the SDK version), options.dist = '1'
  • Sentry.metrics / enableMetrics still compile on 9.22 — no migration needed.
  • Added options.tracePropagationTargets = ['empower-plant.com', 'flask.empower-plant.com', 'flask-otlp.empower-plant.com', 'localhost'].

Web View journey — Flutter → web distributed tracing

New drawer item "Web View" opens the React app (https://empower-plant.com/products) cross-platform:

  • Android/iOS: in-app webview_flutter
  • Flutter web: dart:ui_web iframe
  • Desktop (macOS/Windows/Linux): system browser via url_launcher

It starts its own transaction (webview/empower-plant, op navigation) on a fresh trace, and attaches the active sentry-trace / baggage to the loaded URL as query params so the page's browser SDK can continue the same trace. The screen owns and binds its transaction (bindToScope: true) and finishes it on page load, so the Flutter span reliably lands in the trace.

Note: the browser SDK can only continue a trace from <meta> tags / params, not request headers — hence the URL-param handoff. To fully connect into the live React app, the React side must read those params (separate change in sentry-demos/empower); verified locally end-to-end (Flutter → React /products pageload → flask backend, one trace).

New code: lib/webview/ (web_view_screen.dart, web_view_io.dart, web_view_web.dart, trace_headers.dart). The target URL is kWebViewUrl in web_view_screen.dart.

OTLP backend journey

New drawer item "OTLP" runs the home/shopping experience but routes all backend calls (/products, /checkout) to the OpenTelemetry backend https://flask-otlp.empower-plant.com as its own new trace, so the trace continues into the OTLP-instrumented backend. Backend selection is centralized in lib/backend_config.dart (BackendConfig.base / .products / .checkout).

Web & macOS support

  • Web-safe code: removed dart:io from the shared/web path via conditional-import modules in lib/platform/ (platform_info.dart, native_info_{io,web}.dart, file_io_demo{,_io,_web}.dart). Shared code now uses kIsWeb / defaultTargetPlatform instead of Platform.*. flutter build web / flutter run -d chrome work.
  • macOS: added com.apple.security.network.client to DebugProfile.entitlements and Release.entitlements (sandboxed apps need it to reach the backend + Sentry). flutter run -d macos works.

Build / tooling

  • AGP 8.7.3 → 8.9.1 in android/settings.gradle.kts (required by the androidx libs that webview_flutter/url_launcher pull in; Gradle wrapper 8.12).
  • demo.sh:
    • New ./demo.sh distribute <android|aab|ios> [file] → uploads a build to Sentry Build Distribution (sentry-cli build upload).
    • load_env now sources .env (handles inline comments / special chars) instead of the fragile export $(grep …).
    • upload_size_analysis omits --base-sha when it equals head-sha (Sentry rejects equal SHAs).
  • sentry: web_build_pathweb (the plugin prepends the build dir, so build/web resolved wrongly to build/build/web; web source maps now upload).
  • Includes the Flutter 3.44 migrations applied during the upgrade (iOS UIScene migration, builtInKotlin/newDsl gradle flags, plugin registrants for the new plugins).

UX fixes

  • Cart shows real prices (e.g. $155.00) — removed the UI _maskPrice helper. Financial values are still masked only in Session Replay via the existing maskCallback, so real users see real prices while replays stay private.
  • Product grid layout: the home grid derived its childAspectRatio from the window size, which produced enormous tiles on wide web/desktop windows (products pushed far down). Now uses a stable aspect ratio + max-width cap.
  • The drawer button now has an explicit key so its interaction span reads ui.action.click - open_navigation_menu instead of the cryptic built-in StandardComponentType.drawerButton.

New dependencies

webview_flutter ^4.13.0, url_launcher ^6.3.1, web ^1.1.1.


Testing / verification

  • flutter analyze clean (only the SDK's intended experimental-API warnings).
  • Built & ran on Android emulator, iOS Simulator, macOS, and Chrome (web).
  • Release build + symbol upload verified: release empower_flutter@9.22.0+1 with Dart symbol maps, native debug symbols, and ProGuard mapping uploaded.
  • Distributed tracing verified locally end-to-end: opening the Web View produced a single trace spanning the Flutter webview/empower-plant transaction → React /products pageload → flask backend spans.

Notes for reviewers

  • lib/se_config.dart sets the SE tag to the repo default tda (SEs should not commit their own name; change locally only if needed).
  • Full Flutter→web distributed tracing in production also requires the React app to continue the incoming trace from the URL params (companion change in sentry-demos/empower).
  • The OTLP journey depends on flask-otlp.empower-plant.com being available; when it's down you'll see expected SentryHttpClientError 503s (captured by captureFailedRequests).

🤖 Generated with Claude Code

Prithvirajkumar and others added 2 commits June 19, 2026 15:53
Brings the Empower Plant Flutter demo to the latest Sentry SDK and broadens
platform and feature coverage.

Sentry SDK
- Bump sentry_flutter/sentry_dio/sentry_file/sentry_logging 9.14.0 -> 9.22.0
- Bump sentry_dart_plugin 3.1.0 -> 3.4.0; app version -> 9.22.0+1
- Set options.tracePropagationTargets (empower-plant.com, flask.empower-plant.com,
  flask-otlp.empower-plant.com, localhost)

Web View journey (Flutter -> web distributed tracing)
- New lib/webview/: cross-platform Web View (in-app webview on Android/iOS,
  dart:ui_web iframe on Flutter web, system browser on desktop)
- Opens empower-plant.com/products on its own trace and hands sentry-trace/
  baggage to the page via URL query params so the loaded React app's browser
  SDK continues the same trace (Flutter -> React -> backend = one trace)
- WebViewScreen owns + binds its transaction (bindToScope) and finishes it on
  page load, so the Flutter span reliably joins the trace

OTLP backend journey
- New "OTLP" drawer item runs the home experience but routes all backend calls
  (/products, /checkout) to the OpenTelemetry backend flask-otlp.empower-plant.com
- Backend selection centralized in lib/backend_config.dart (standard vs OTLP)

Web & macOS support
- Make the code web-safe: remove dart:io from the shared/web path via
  conditional-import modules in lib/platform/; use kIsWeb/defaultTargetPlatform
  instead of Platform.* in shared code
- macOS: add com.apple.security.network.client entitlement (sandbox network)

Build / tooling
- Android Gradle Plugin 8.7.3 -> 8.9.1 (required by androidx libs pulled in by
  webview_flutter/url_launcher)
- demo.sh: add `distribute <android|aab|ios>` (Sentry Build Distribution),
  source .env robustly (handles inline comments), and omit --base-sha when it
  equals head-sha
- sentry: web_build_path -> web (correct web source map upload path)
- Flutter 3.44 migrations (iOS UIScene, builtInKotlin/newDsl, plugin registrants)

UX
- Cart shows real prices; financial values are masked only in Session Replay
- Fix product grid layout on wide web/desktop windows (stable aspect ratio +
  max-width cap) so products are not pushed far down the page
- Custom keyed drawer button so the interaction span reads
  "ui.action.click - open_navigation_menu"

Docs: update README, CLAUDE, BUILD_GUIDE, SENTRY_FEATURES, SIZE_ANALYSIS.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… own name)

Clarify in se_config.dart that 'tda' is the committed default and engineers
should not push their own identifier.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Prithvirajkumar Prithvirajkumar merged commit 4340700 into main Jun 19, 2026
1 check passed
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.

1 participant