-
-
Notifications
You must be signed in to change notification settings - Fork 315
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: Add support for profiling on iOS #1652
Conversation
to disambiguate from log/src/Log.{h,cpp}; they became ambiguous after putting them in the same target vs separate bazel targets, as well as the includes being the same name after removing the bazel path prefixes
it seemed to become ambiguous with stdlib <time.h> and caused a build error: 'chrono' file not found
- change all files from pure C++ to Objective-C++ (.mm extensions) - using the polyfills instead of protobufs - add a few more needed files - remove spdlog and fmt for now, remove all log logic and define the macros to no-ops - fix the cast to dispatch_queue_t in ThreadHandle that was breaking under ARC
at the point where Specto used to serialize the protobuf to data and write it to packets to the ring buffer, we now create a NSDictionary containing all the same fields with original names and serialize that to NSData that is then written to a SentryEnvelope add old configuration options like sampling rate, wether profiling is enabled etc into SentryOptions
|
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'm thrilled to see the first draft PR from Specto 🎉, @armcknight.
FYI, we use the logaf scale for PR review comments. In short, we start the comments with l,m,h standing for the importance of the comment low, medium, high. Low are just nitpicks, medium is worth addressing and discussing, and high is something really important.
I didn't take a close look at the profiling code, because I guess this code was already reviewed. If you have tests for the profiling code I think we should also add them and run them in CI.
@armcknight CI is complaining, so I think we still need to adapt the Sentry.podspec and Package.swift.
For the SentryOptions
we still need tests. For the BOOL properties, you can add tests as simple as
sentry-cocoa/Tests/SentryTests/SentryOptionsTest.m
Lines 176 to 179 in 06f40f9
- (void)testEnableNetworkBreadcrumbs | |
{ | |
[self testBooleanField:@"enableNetworkBreadcrumbs"]; | |
} |
to try to roll back from C++17, as that was when this was first supported
- remove __APPLE__ and __ANDROID__ specific gates - change NDEBUG (bazel) usages to DEBUG (Xcode)
Codecov Report
@@ Coverage Diff @@
## master #1652 +/- ##
==========================================
- Coverage 94.87% 92.53% -2.35%
==========================================
Files 171 187 +16
Lines 7751 8657 +906
==========================================
+ Hits 7354 8011 +657
- Misses 397 646 +249
Continue to review full report at Codecov.
|
@philipphofmann I'm taking over this PR and will address all the comments since @armcknight is now out on paternity, will have an update soon! Thank you. |
Hey @indragiek, Phillip is out on vocation the entire month. If you need something, you can ping me or @bruno-garcia |
…try-cocoa into armcknight/specto-cpp-port
…try-cocoa into armcknight/specto-cpp-port
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.
A few minor things. Thanks 🙏
@@ -395,6 +395,42 @@ class SentryTracerTests: XCTestCase { | |||
XCTAssertEqual(["key": 0], sut.data as! [String: Int]) | |||
} | |||
|
|||
#if os(iOS) |
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.
l
:
#if os(iOS) | |
#if os(iOS) || os(tvOS) |
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.
Profiling doesn't work on tvOS because the necessary APIs are not exported, same with watchOS. See SENTRY_TARGET_PROFILING_SUPPORTED. I did notice this should have macOS added to it, I will make that change.
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.
Changed this check to support macOS, iOS, and mac catalyst (but not tvOS or watchOS)
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 🚀
📜 Description
Integrates a subset of the Specto iOS SDK code to implement support for profiling on iOS. This PR contains the changes to bring in that existing code and also integrate it with the Sentry SDK such that profiles are captured alongside transactions.
💡 Motivation and Context
The profiling product will first be available on iOS & Android, based on tech acquired from Specto. This is the first attempt at integrating that functionality into the Sentry Cocoa SDK.
💚 How did you test it?
Add new automated tests, build and run in the
iOS-Swift
test app and ensure that the envelope generated with the new profiling envelope item contains the right data.📝 Checklist
🔮 Next steps
SentryProfiler
debug_meta
field so the backend can symbolicate