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

Add Flutter runtime information #2742

Merged
merged 17 commits into from
Mar 11, 2025
Merged

Conversation

ueman
Copy link
Collaborator

@ueman ueman commented Feb 20, 2025

📜 Description

Fun fact: This fixes the oldest currently open issue in this repo

💡 Motivation and Context

#416

💚 How did you test it?

I'm not entirely sure how to test this, since Dart defines aren't mockable.

You can test this manually by switching to the master channel of Flutter and building an app.

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

Wait until the Flutter PR is merged, then merge this.

Copy link

codecov bot commented Feb 20, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.96%. Comparing base (40daa7b) to head (e5e0425).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...rocessor/enricher/io_enricher_event_processor.dart 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2742      +/-   ##
==========================================
- Coverage   88.97%   88.96%   -0.01%     
==========================================
  Files         263      263              
  Lines        8925     8926       +1     
==========================================
  Hits         7941     7941              
- Misses        984      985       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ueman ueman marked this pull request as ready for review February 20, 2025 17:48
@buenaflor
Copy link
Contributor

ohh nice! 🥳

@ueman ueman marked this pull request as draft February 20, 2025 18:14
Comment on lines +54 to +57
/// The URL of the Git repository from which Flutter was obtained.
static const String? gitUrl = bool.hasEnvironment('FLUTTER_GIT_URL')
? String.fromEnvironment('FLUTTER_GIT_URL')
: null;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should this be included in a context somewhere?

@ueman
Copy link
Collaborator Author

ueman commented Feb 24, 2025

This PR is ready to review now, but maybe we should wait with merging a little to see whether the changes are sticking this time in the Flutter framework

@ueman ueman marked this pull request as ready for review February 24, 2025 21:39
@ueman
Copy link
Collaborator Author

ueman commented Feb 28, 2025

@buenaflor The linked PR is sticking, so it should be safe to merge now.

// This is included since [Platform.version](https://api.dart.dev/stable/dart-io/Platform/version.html)
// is not included on web platforms.
/// The Dart version used to compile the app.
static const String? dartVersion = bool.hasEnvironment('FLUTTER_DART_VERSION')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's slightly different than Platform.version:

  • Platform.version: 3.8.0-133.0.dev (dev) (Sun Feb 23 12:02:50 2025 -0800) on "macos_x64"
  • FlutterVersion.dartVersion: 3.8.0 (build 3.8.0-133.0.dev)

@ueman
Copy link
Collaborator Author

ueman commented Mar 5, 2025

@denrase Are you able to do a review on this?

Copy link
Collaborator

@denrase denrase left a comment

Choose a reason for hiding this comment

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

Nice! \o/ We just need to make sure to also add it in the html enricher, as well as make CI happy.

///
/// When this Flutter version was build from a fork, or when Flutter runs in a
/// custom embedder, these values might be unreliable.
abstract class FlutterVersion {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is code from your Flutter PR, would it also make sense to bring the corresponding tests over?

Copy link
Collaborator

@denrase denrase left a comment

Choose a reason for hiding this comment

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

Lookin' good, thank you!

@denrase
Copy link
Collaborator

denrase commented Mar 10, 2025

@ueman The tests are failing on current dart versions and we have one analyser issue (formatting) left. Could we disable the tests for unsupported dart/flutter versions?

Bildschirmfoto 2025-03-10 um 10 16 50

@ueman
Copy link
Collaborator Author

ueman commented Mar 10, 2025

Ahh, good point. I think we can wrap the tests in a group and use bool.hasEnvironment() to enable the tests if the environment things are available.

Edit: Nevermind, those test will never work since they're executed in the Dart test runner which will never have those dart defines available, since they're only available in a Flutter environment. Soooo, maybe we should just delete the tests again?

@denrase
Copy link
Collaborator

denrase commented Mar 10, 2025

@ueman Ah got it, moving them to sentry_flutter will probably not work as this is not exposed publicly?

@ueman
Copy link
Collaborator Author

ueman commented Mar 10, 2025

@ueman Ah got it, moving them to sentry_flutter will probably not work?

Good idea! I haven't thought about that, but I could imagine that working.

@ueman
Copy link
Collaborator Author

ueman commented Mar 10, 2025

@denrase It works 🥳 Everything that's red is unrelated to what I've done, I think.

@denrase
Copy link
Collaborator

denrase commented Mar 10, 2025

@ueman Cool, i'll check out your branch and see that I fix what's causing the CI to fail.

@denrase
Copy link
Collaborator

denrase commented Mar 10, 2025

@ueman Think the skip condition needs to be inverted. Also we can ignore failing e2e tests, since the token is missing in your branch, which is also why they fail.

@denrase
Copy link
Collaborator

denrase commented Mar 11, 2025

@ueman Would you be so kind and sync the main of your fork with sentry? Just landed a fix for CI issues. After that, I'll merge those in here and then we are good to go. 🙇‍♂️

@denrase
Copy link
Collaborator

denrase commented Mar 11, 2025

@buenaflor FYI, the integration e2e test is not running because we do not have the token available in forks. Maybe we should consider skipping the test in this case?

@buenaflor
Copy link
Contributor

qq, is this important to have in v8? maybe we can just add it to v9 directly

@denrase
Copy link
Collaborator

denrase commented Mar 11, 2025

@buenaflor This is not breaking anything, just adding additional info about Flutter runtime. Don't see a reason why this could not be merged directly to main. WDYT?

@buenaflor
Copy link
Contributor

@denrase nothing really wrong with the PR and adding it to v8 but I'm asking because I was thinking of making a 8.14.0 (non-beta) release but I guess we'd wanna do another beta now if we merge this. or we just include this into the 8.14.0 without a beta, not sure, let's talk about it in the sync

@ueman
Copy link
Collaborator Author

ueman commented Mar 11, 2025

FWIW, I don't think the changes in this PR need a beta release

@buenaflor
Copy link
Contributor

I'll merge this unless there's anything else to be added @denrase @ueman

@ueman
Copy link
Collaborator Author

ueman commented Mar 11, 2025

Please go ahead, there's nothing to add from my side

@buenaflor buenaflor merged commit 95ebf3f into getsentry:main Mar 11, 2025
142 of 146 checks 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.

Report version of Flutter
3 participants