Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All events captured by the logging integration are grouped together #1392

Closed
maBarabas opened this issue Apr 17, 2023 · 4 comments · Fixed by #1398
Closed

All events captured by the logging integration are grouped together #1392

maBarabas opened this issue Apr 17, 2023 · 4 comments · Fixed by #1398

Comments

@maBarabas
Copy link
Contributor

Platform

Flutter Mobile

Obfuscation

Disabled

Debug Info

Enabled

Doctor

[!] Flutter (Channel stable, 3.7.1, on macOS 13.1 22C65 darwin-x64, locale en-GB)
• Flutter version 3.7.1 on channel stable at /Users/barabas/source/flutter
! Warning: dart on your path resolves to /usr/local/Cellar/dart/2.19.3/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/barabas/source/flutter. Consider adding /Users/barabas/source/flutter/bin
to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7048ed95a5 (3 months ago), 2023-02-01 09:07:31 -0800
• Engine revision 800594f1f4
• Dart version 2.19.1
• DevTools version 2.20.1
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Users/barabas/Library/Android/sdk
✗ cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3

[!] Android Studio (version 2022.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
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.

[✓] VS Code (version 1.74.3)
• VS Code at /Users/barabas/Downloads/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
• iPhone XR (mobile) • 00008020-001E2C881A33002E • ios • iOS 15.6.1 19G82
• macOS (desktop) • macos • darwin-x64 • macOS 13.1 22C65 darwin-x64

[✓] HTTP Host Availability
• All required HTTP hosts are available

! Doctor found issues in 3 categories.

Version

6.22.0

Steps to Reproduce

Enable the logging integration and write a severe log. Do not provide an error or stacktrace parameter to the logger.

Expected Result

The event generated by the log includes a stack trace, filename and line number information of where the log was written from.

Every time the log runs, a new event is added to the same group in the web UI.

Every time a different line logs an event a new group is created for that log.

Actual Result

The generated event has a filename and stacktrace of <asynchronous suspension>. All of the severe logs in the project are grouped under this stack trace in the web UI using the default grouping.

image

image

I expected every instance of a severe log to be grouped with other events generated by the same line. I tried to set up a custom group, but the best I seem to be able to do is to completely prevent grouping using the following line:

stack.abs_path:"<asynchronous suspension>" -> nostack, {{ message }}

Are you willing to submit a PR?

Yes

@maBarabas
Copy link
Contributor Author

maBarabas commented Apr 17, 2023

I've found a workaround by setting recordStackTraceAtLevel to match the minEventLevel. Now all severe logs have a backtrace, either through the logging library providing the current stacktrace, or the user provided one through the function parameter.

This solution works for me. I'll keep the issue open so that it can be added to the documentation.

@marandaneto
Copy link
Contributor

@maBarabas thank you for raising this.
I see, if no stackTrace is provided, the SDK gets the Stacktrace.current automatically, and due to the nature of async/await stuff, they could look like this "asynchronous suspension".
Another option is setting a beforeSend callback and removing all the threads values, then the event will be grouped by the message field and not stack trace anymore.
Using Stacktrace.current automatically also has its benefits so changing this behavior is not desirable.
I'm not sure we can do something here, if you found a workaround, can we close this?

@maBarabas
Copy link
Contributor Author

If the SDK uses Stacktrace.current, and it returns a meaninless stack trace like a single frame of <asynchronous suspension>, would it make sense to submit the event without a stacktrace instead? That would then fall back to grouping by message which is more desirable I think. This can be done inside the SDK without any user configuration, and prevents the bug where unrelated events are grouped together because of the low quality stack trace.

If the stacktrace is meaningful, the event can be submitted with the stacktrace as usual and nothing changes.

I think this would be a good change, since it resolves the bad grouping when using the default configuration. If you don't want to implement it, you can close the issue, as I'm happy with the workaround.

@marandaneto
Copy link
Contributor

@maBarabas that makes sense, if its a single frame and has that label, we could strip it out, this should be possible on the server as well with stack trace rules, let me check which ones make more sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants