-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
feat: Pass the enableProfiling configuration through to the native SDK #851
base: main
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -132,6 +132,7 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { | |||
args.getIfNotNull<Boolean>("anrEnabled") { options.isAnrEnabled = it } | |||
args.getIfNotNull<Boolean>("sendDefaultPii") { options.isSendDefaultPii = it } | |||
args.getIfNotNull<Boolean>("enableNdkScopeSync") { options.isEnableScopeSync = it } | |||
args.getIfNotNull<Boolean>("enableProfiling") { options.isProfilingEnabled = it } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That alone isn't enough, since we don't enable performance by default on the Native layer.
My suggestion is: if enableProfiling
is given, set the tracesSampleRate
to the options as well.
Ps: This will only work if people startTransaction
on the Native layer or using auto instrumentation for Native screens, transactions started on the Dart layer won't contain any profiling data, this is something we can improve later.
if let enableProfiling = arguments["enableProfiling"] as? Bool { | ||
options.enableProfiling = enableProfiling | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Enable capturing CPU profiles alongside transactions. | ||
/// Only available on iOS and Android. This is currently a beta feature that is | ||
/// not available to all Sentry customers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also write that transactions started on the Dart layer won't have profile data, but only transactions started on the Native layer (Android/iOS).
@@ -376,12 +376,24 @@ class AndroidExample extends StatelessWidget { | |||
}, | |||
child: const Text('Platform exception'), | |||
), | |||
ElevatedButton( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move under the Main widget instead of AndroidExample only
@@ -39,6 +43,12 @@ class MainActivity : FlutterActivity() { | |||
"platform_exception" -> { | |||
result.success(Thread.currentThread().getStackTrace()) | |||
} | |||
"startProfiling" -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also exist under AppDelegate#handleMessage
or let the buttons live only in the Android widget as it is now.
@@ -39,6 +43,12 @@ class MainActivity : FlutterActivity() { | |||
"platform_exception" -> { | |||
result.success(Thread.currentThread().getStackTrace()) | |||
} | |||
"startProfiling" -> { | |||
transaction = Sentry.startTransaction("myTransactionWithProfiling", "task") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't test this because of getsentry/sentry-java#2009
@@ -42,5 +42,7 @@ | |||
<meta-data | |||
android:name="flutterEmbedding" | |||
android:value="2" /> | |||
|
|||
<meta-data android:name="io.sentry.traces.profiling.enable" android:value="true" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you remove the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
📜 Description
The most recent versions of the Sentry SDK's for iOS and Android support profiling. This PR adds an argument to the Flutter configuration options that gets passed through to the native SDK.
💡 Motivation and Context
To be able to profile native code in an app that uses the Sentry Flutter SDK. Note that this does not add support for actually profiling within the Dart VM, only native code.
💚 How did you test it?
Updated the existing tests.
📝 Checklist
🔮 Next steps