getsentry / sentry-dart

Sentry SDK for Dart and Flutter
https://sentry.io/for/flutter/
MIT License
761 stars 239 forks source link

Manually adding breadcrumbs to a sentry event, only works for iOS and not Android #1985

Closed christianhurley closed 6 months ago

christianhurley commented 7 months ago

Platform

Flutter Mobile

Obfuscation

Disabled

Debug Info

Disabled

Doctor

[✓] Flutter (Channel stable, 3.19.1, on macOS 14.2.1 23C71 darwin-arm64, locale da-DK) • Flutter version 3.19.1 on channel stable at /Users/hurley/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision abb292a07e (7 weeks ago), 2024-02-20 14:35:05 -0800 • Engine revision 04817c99c9 • Dart version 3.3.0 • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/hurley/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C500b • CocoaPods version 1.15.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Community Edition (version 2023.3.4) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 78.1.1 • Dart plugin version 233.13763.5

[✓] Connected device (4 available)
• SM G960F (mobile) • 221c919427027ece • android-arm64 • Android 10 (API 29) • iPhone 15 (mobile) • ACAFE1FD-6161-4C5F-9F0A-B5D12D03ED29 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.2.1 23C71 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.122

[✓] Network resources • All expected network resources are available.

• No issues found!

Version

7.18.0

Steps to Reproduce

  1. Capture an exception
  2. Try to manually add breadcrumbs to the SentryEvent in beforeSend()
  3. Return the event with the added breadcrumb

Expected Result

That the sentry event is sent to sentry and that we can see the added breadcrumb in the sentry event

Actual Result

The breadcrumb is only added to the events that are logged by iOS devices, and if an android device tries to create an event, the breadcrumb is not there.

Are you willing to submit a PR?

None

christianhurley commented 7 months ago
SentryEvent? beforeSend(SentryEvent event, {Hint? hint}) {
   event.breadcrumbs?.add(
      Breadcrumb(
          message: "Added breadcrumb",
          timestamp: DateTime.now().toUtc(),
          level: SentryLevel.info));
  return event;
}

The following code gives adds the breadcrumb from iOS devices, but not if it is an Android device

buenaflor commented 7 months ago

Thank you for reporting, I can confirm this, we'll take a look

buenaflor commented 7 months ago

This should be fixed in v8, can you confirm @denrase ? since we removed the code that removes breadcrumbs

christianhurley commented 7 months ago

Awesome, ill leave the issue open until it has been released. Thank you!

denrase commented 6 months ago

Just confirmed with 8.0, that both iOS and Android have the added breadcrumbs.