github getsentry/sentry-dart 9.19.0

13 hours ago

Features

  • Span-first trace lifecycle (experimental) by @buenaflor in #3659
    • Streams spans to Sentry as each one finishes instead of buffering them into a transaction envelope at the root.
    • Opt in via options.traceLifecycle. The classic transaction-based SentryTraceLifecycle.static remains the default.
    • In stream mode, create spans with the new Sentry.startSpan / Sentry.startSpanSync APIs — the transaction APIs (Sentry.startTransaction, ISentrySpan.startChild) do nothing in this mode.
    • Auto-instrumentations (frames, app start, TTID/TTFD, navigation, user interaction, HTTP, databases, GraphQL link) automatically switch to the streaming API when enabled.
// Opt in during SDK init.
await SentryFlutter.init((options) {
  options.dsn = 'https://example@sentry.io/add-your-dsn-here';
  options.tracesSampleRate = 1.0;
  options.traceLifecycle = SentryTraceLifecycle.stream;
});

// Async work — the span ends and is sent when the future completes.
final order = await Sentry.startSpan('checkout', (span) async {
  span.setAttribute('cart.item_count', SentryAttribute.int(cart.items.length));

  // Automatically parents to 'checkout' via zones.
  final payment = await Sentry.startSpan('process-payment', (span) {
    return paymentService.charge(cart.total);
  });

  return orderService.create(cart, payment: payment);
});

// Sync variant.
final total = Sentry.startSpanSync('calculate-total', (span) {
  return cart.items.fold<double>(0, (sum, item) => sum + item.price);
});

Fixes

  • (feedback) Show success message after feedback submission by @denrase in #3609

Enhancements

  • (navigator-observer) enableNewTraceOnNavigation is now opt-in by @buenaflor in #3657
    • SentryNavigatorObserver no longer generates a fresh trace id on every push/pop/replace by default. One trace per session (the previous opt-in behavior) is now the default and preserves trace continuity across navigations.
    • If you relied on the old behavior, opt back in explicitly:
SentryNavigatorObserver(
  enableNewTraceOnNavigation: true,
);

Dependencies

  • chore(deps): update Android SDK to v8.39.1 by @github-actions in #3646

Internal Changes

Deps

  • Bump actions/create-github-app-token from 3.0.0 to 3.1.1 by @dependabot in #3652
  • Bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.25.2 to 2.25.4 by @dependabot in #3655
  • Bump actions/cache from 5.0.4 to 5.0.5 by @dependabot in #3656

Other

Don't miss a new sentry-dart release

NewReleases is sending notifications on new releases.