-
-
Notifications
You must be signed in to change notification settings - Fork 324
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
chore: update profiling API for hybrid SDKs #3255
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -85,13 +85,21 @@ typedef void (^SentryOnAppStartMeasurementAvailable)( | |||||||||||||||||||||
* Start a profiler session associated with the given @c SentryId. | ||||||||||||||||||||||
* @return The system time when the profiler session started. | ||||||||||||||||||||||
*/ | ||||||||||||||||||||||
+ (uint64_t)startProfilingForTrace:(SentryId *)traceId; | ||||||||||||||||||||||
+ (uint64_t)startProfilerForTrace:(SentryId *)traceId; | ||||||||||||||||||||||
|
||||||||||||||||||||||
/** | ||||||||||||||||||||||
* Collect a profiler session data associated with the given @c SentryId. | ||||||||||||||||||||||
* This also discards the profiler. | ||||||||||||||||||||||
*/ | ||||||||||||||||||||||
+ (nullable NSDictionary<NSString *, id> *)collectProfileForTrace:(SentryId *)traceId | ||||||||||||||||||||||
since:(uint64_t)startSystemTime; | ||||||||||||||||||||||
+ (nullable NSDictionary<NSString *, id> *)collectProfileBetween:(uint64_t)startSystemTime | ||||||||||||||||||||||
and:(uint64_t)endSystemTime | ||||||||||||||||||||||
forTrace:(SentryId *)traceId; | ||||||||||||||||||||||
Comment on lines
+94
to
+96
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. h: Need to change the function signature to follow our pattern.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1. in general method parameter names like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't know that. I've done it the same way as in the forwarded function: sentry-cocoa/Sources/Sentry/SentryProfiler.mm Lines 370 to 373 in b9d59f7
|
||||||||||||||||||||||
|
||||||||||||||||||||||
/** | ||||||||||||||||||||||
* Discard profiler session data associated with the given @c SentryId. | ||||||||||||||||||||||
* This only needs to be called in case you haven't collected the profile (and don't intend to). | ||||||||||||||||||||||
*/ | ||||||||||||||||||||||
+ (void)discardProfilerForTrace:(SentryId *)traceId; | ||||||||||||||||||||||
#endif | ||||||||||||||||||||||
|
||||||||||||||||||||||
@property (class, nullable, nonatomic, copy) | ||||||||||||||||||||||
|
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 is going to get the thread ID at the time that the profile is being processed, why are we overwriting the one previously set at the time the trace was started with this one? I imagine it's possible to have a different active thread for each of the 3 times: 1) when the profile is started, 2) ended and 3) being processed.
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.
We are not, there's no thread ID stored when the profiler is started. There is one stored when a transaction is started, but that doesn't apply here, where we don't start objective-c transactions. And I'm aware this may be different in those scenarios, and am not completely certain it's going to be correct the way it works in Flutter but this was the simplest approach and if it works, than no need to complicate things. If it doesn't, I'll follow up.
It's not great that I cannot test this in Flutter without the cocoa SDK being released (or without messing up with the flutter plugin build setup) - so it's a bit of a guesswork and needs a couple of iterations 🤷