From 73a05967774387829fb589c45c5e08d68679f692 Mon Sep 17 00:00:00 2001 From: getsentry-bot Date: Mon, 5 Dec 2022 13:25:55 +0000 Subject: [PATCH 01/31] release: 8.0.0-beta.4 --- CHANGELOG.md | 4 ++-- Sentry.podspec | 4 ++-- SentryPrivate.podspec | 2 +- Sources/Configuration/Sentry.xcconfig | 2 +- Sources/Configuration/SentryPrivate.xcconfig | 2 +- Sources/Sentry/SentryMeta.m | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6c409b721c..0e35aabf54d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.0.0-beta.4 This version adds a dependency on Swift. @@ -48,7 +48,7 @@ This version adds a dependency on Swift. - Rename `SentryOptions.enableCoreDataTracking` to `enableCoreDataTracing` - SentrySDK.close calls flush, which is a blocking call (#2453) - Bump minimum Xcode version to 13 (#2483) - + ## 7.31.3 ### Fixes diff --git a/Sentry.podspec b/Sentry.podspec index bcdc91eaa03..4d09ba2ab67 100644 --- a/Sentry.podspec +++ b/Sentry.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Sentry" - s.version = "8.0.0" + s.version = "8.0.0-beta.4" s.summary = "Sentry client for cocoa" s.homepage = "https://github.com/getsentry/sentry-cocoa" s.license = "mit" @@ -27,7 +27,7 @@ Pod::Spec.new do |s| } s.default_subspecs = ['Core'] - s.dependency "SentryPrivate", "8.0.0" + s.dependency "SentryPrivate", "8.0.0-beta.4" s.subspec 'Core' do |sp| sp.source_files = "Sources/Sentry/**/*.{h,hpp,m,mm,c,cpp}", diff --git a/SentryPrivate.podspec b/SentryPrivate.podspec index 997d5b75cf1..e6770ce7404 100644 --- a/SentryPrivate.podspec +++ b/SentryPrivate.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SentryPrivate" - s.version = "8.0.0" + s.version = "8.0.0-beta.4" s.summary = "Sentry Private Library." s.homepage = "https://github.com/getsentry/sentry-cocoa" s.license = "mit" diff --git a/Sources/Configuration/Sentry.xcconfig b/Sources/Configuration/Sentry.xcconfig index 6486f172a77..032e2008e7a 100644 --- a/Sources/Configuration/Sentry.xcconfig +++ b/Sources/Configuration/Sentry.xcconfig @@ -2,6 +2,6 @@ PRODUCT_NAME = Sentry INFOPLIST_FILE = Sources/Sentry/Info.plist PRODUCT_BUNDLE_IDENTIFIER = io.sentry.Sentry -CURRENT_PROJECT_VERSION = 8.0.0 +CURRENT_PROJECT_VERSION = 8.0.0-beta.4 MODULEMAP_FILE = $(SRCROOT)/Sources/Sentry/Sentry.modulemap diff --git a/Sources/Configuration/SentryPrivate.xcconfig b/Sources/Configuration/SentryPrivate.xcconfig index 169a318d8bf..b160c4b24a0 100644 --- a/Sources/Configuration/SentryPrivate.xcconfig +++ b/Sources/Configuration/SentryPrivate.xcconfig @@ -1,3 +1,3 @@ PRODUCT_NAME = SentryPrivate MACH_O_TYPE = staticlib -CURRENT_PROJECT_VERSION = 8.0.0 +CURRENT_PROJECT_VERSION = 8.0.0-beta.4 diff --git a/Sources/Sentry/SentryMeta.m b/Sources/Sentry/SentryMeta.m index fd8c1047db1..dcf534321db 100644 --- a/Sources/Sentry/SentryMeta.m +++ b/Sources/Sentry/SentryMeta.m @@ -5,7 +5,7 @@ @implementation SentryMeta // Don't remove the static keyword. If you do the compiler adds the constant name to the global // symbol table and it might clash with other constants. When keeping the static keyword the // compiler replaces all occurrences with the value. -static NSString *versionString = @"8.0.0"; +static NSString *versionString = @"8.0.0-beta.4"; static NSString *sdkName = @"sentry.cocoa"; + (NSString *)versionString From 010583c7602d4534140884a8b87c319bcd927768 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Mon, 5 Dec 2022 14:35:29 +0100 Subject: [PATCH 02/31] test: Disable testConcurrentSpansWithTimeout_disabled (#2487) --- Sentry.xcodeproj/xcshareddata/xcschemes/Sentry.xcscheme | 3 +++ Tests/SentryTests/Profiling/SentryProfilerSwiftTests.swift | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Sentry.xcodeproj/xcshareddata/xcschemes/Sentry.xcscheme b/Sentry.xcodeproj/xcshareddata/xcschemes/Sentry.xcscheme index a8bc3edae86..e699b35db4f 100644 --- a/Sentry.xcodeproj/xcshareddata/xcschemes/Sentry.xcscheme +++ b/Sentry.xcodeproj/xcshareddata/xcschemes/Sentry.xcscheme @@ -91,6 +91,9 @@ + + diff --git a/Tests/SentryTests/Profiling/SentryProfilerSwiftTests.swift b/Tests/SentryTests/Profiling/SentryProfilerSwiftTests.swift index 9021dec84b0..166ca2985e7 100644 --- a/Tests/SentryTests/Profiling/SentryProfilerSwiftTests.swift +++ b/Tests/SentryTests/Profiling/SentryProfilerSwiftTests.swift @@ -80,7 +80,7 @@ class SentryProfilerSwiftTests: XCTestCase { /// transaction B |-------| /// profiler B |-------| <- normal finish /// ``` - func testConcurrentSpansWithTimeout() { + func testConcurrentSpansWithTimeout_disabled() { let options = fixture.options options.profilesSampleRate = 1.0 options.tracesSampleRate = 1.0 From 323cdfe7f0475e9c166777a01ac20758c1116791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Wold=C5=99ich?= <31292499+krystofwoldrich@users.noreply.github.com> Date: Mon, 5 Dec 2022 14:38:35 +0100 Subject: [PATCH 03/31] fix(screenshots): Don't capture zero size screenshots (#2459) Co-authored-by: Dhiogo Brustolin Co-authored-by: Sentry Github Bot Co-authored-by: Philipp Hofmann --- CHANGELOG.md | 1 + Sources/Sentry/SentryScreenshot.m | 7 ++++++- Tests/SentryTests/SentryScreenShotTests.swift | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6c409b721c..4bc6bb509a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This version adds a dependency on Swift. - Increase `SentryCrashMAX_STRINGBUFFERSIZE` to reduce the instances where we're dropping a crash due to size limit (#2465) - `SentryAppStateManager` correctly unsubscribes from `NSNotificationCenter` when closing the SDK (#2460) - The SDK no longer reports an OOM when a crash happens after closing the SDK (#2468) +- Don't capture zero size screenshots ([#2459](https://github.com/getsentry/sentry-cocoa/pull/2459)) - Use the preexisting app release version format for profiles (#2470) ### Breaking Changes diff --git a/Sources/Sentry/SentryScreenshot.m b/Sources/Sentry/SentryScreenshot.m index a3eba3e120b..9fe1ee45ab2 100644 --- a/Sources/Sentry/SentryScreenshot.m +++ b/Sources/Sentry/SentryScreenshot.m @@ -47,7 +47,12 @@ - (void)saveScreenShots:(NSString *)path if ([window drawViewHierarchyInRect:window.bounds afterScreenUpdates:false]) { UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); - [result addObject:UIImagePNGRepresentation(img)]; + if (img.size.width > 0 || img.size.height > 0) { + NSData *bytes = UIImagePNGRepresentation(img); + if (bytes && bytes.length > 0) { + [result addObject:bytes]; + } + } } UIGraphicsEndImageContext(); diff --git a/Tests/SentryTests/SentryScreenShotTests.swift b/Tests/SentryTests/SentryScreenShotTests.swift index e8dc6725486..351d72697bb 100644 --- a/Tests/SentryTests/SentryScreenShotTests.swift +++ b/Tests/SentryTests/SentryScreenShotTests.swift @@ -80,7 +80,18 @@ class SentryScreenShotTests: XCTestCase { XCTAssertEqual(image?.size.width, 10) XCTAssertEqual(image?.size.height, 10) + } + + func test_ZeroSizeScreenShot_GetsDiscarded() { + let testWindow = TestWindow(frame: CGRect(x: 0, y: 0, width: 0, height: 0)) + fixture.uiApplication.windows = [testWindow] + + guard let data = self.fixture.sut.appScreenshots() else { + XCTFail("Could not make window screenshot") + return + } + XCTAssertEqual(0, data.count, "No screenshot should be taken, cause the image has zero size.") } class TestSentryUIApplication: SentryUIApplication { From 98fb18fbfd3ec3bd87ab8deec265f894416e255c Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Tue, 6 Dec 2022 08:11:11 +0100 Subject: [PATCH 04/31] ci: Specify Codecov token (#2492) Co-authored-by: Andrew McKnight --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cc5db69e8d2..c32a9847f08 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -220,6 +220,9 @@ jobs: uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # pin@v3.1.1 if: ${{ contains(matrix.platform, 'iOS') }} with: + # Although public repos should not have to specify a token there seems to be a bug with the Codecov GH action, which can + # be solved by specifying the token, see https://github.com/codecov/codecov-action/issues/557#issuecomment-1224970469 + token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true verbose: true From 5ed4bee8534ebc9733c60b1aa1661bc9d7e327ee Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Tue, 6 Dec 2022 09:57:05 +0100 Subject: [PATCH 05/31] feat: MetricKit TestVersion 1 (#2476) This PR adds a first iteration of sending MetricKitData of MXCrashDiagnostic, MXCPUExceptionDiagnostic, and MXDiskWriteExceptionDiagnostic to Sentry. This PRs aim is to have the code running in the iOS-Swift test app via TestFlight to get some real MetricKit data of MXCPUExceptionDiagnostic, and MXDiskWriteExceptionDiagnostic. MXCrashDiagnostic exists solely for validating the stacktrace symbolication. --- .../iOS-Swift.xcodeproj/project.pbxproj | 6 + Samples/iOS-Swift/iOS-Swift/AppDelegate.swift | 3 + .../iOS-Swift/Base.lproj/Main.storyboard | 32 +- .../iOS-Swift/Tools/DiskWriteException.swift | 75 ++ .../iOS-Swift/iOS-Swift/ViewController.swift | 35 +- .../macOS-Swift.xcodeproj/project.pbxproj | 15 + Sentry.xcodeproj/project.pbxproj | 48 + Sources/Sentry/Public/SentryDefines.h | 6 + Sources/Sentry/Public/SentryOptions.h | 13 + Sources/Sentry/SentryBaseIntegration.m | 9 + Sources/Sentry/SentryDependencyContainer.m | 18 + Sources/Sentry/SentryMetricKitIntegration.m | 190 ++++ Sources/Sentry/SentryOptions.m | 34 +- .../Sentry/include/SentryBaseIntegration.h | 1 + .../include/SentryDependencyContainer.h | 7 +- .../include/SentryMetricKitIntegration.h | 19 + .../MetricKit/SentryMXCallStackTree.swift | 62 ++ Sources/Swift/MetricKit/SentryMXManager.swift | 72 ++ .../metric-kit-callstack-tree-garbage.json | 23 + .../metric-kit-callstack-tree-real.json | 881 ++++++++++++++++++ .../metric-kit-callstack-tree-simple.json | 26 + ...ric-kit-callstack-tree-unknown-fields.json | 27 + .../SentryMXCallStackTreeTests.swift | 76 ++ .../SentryMetricKitIntegrationTests.swift | 144 +++ .../SentryNSURLSessionTaskSearchTests.swift | 2 +- Tests/SentryTests/SentryOptionsTest.m | 6 + .../SentryTests/SentryTests-Bridging-Header.h | 1 + .../TestUtils/TestExtensions.swift | 8 + 28 files changed, 1817 insertions(+), 22 deletions(-) create mode 100644 Samples/iOS-Swift/iOS-Swift/Tools/DiskWriteException.swift create mode 100644 Sources/Sentry/SentryMetricKitIntegration.m create mode 100644 Sources/Sentry/include/SentryMetricKitIntegration.h create mode 100644 Sources/Swift/MetricKit/SentryMXCallStackTree.swift create mode 100644 Sources/Swift/MetricKit/SentryMXManager.swift create mode 100644 Tests/Resources/metric-kit-callstack-tree-garbage.json create mode 100644 Tests/Resources/metric-kit-callstack-tree-real.json create mode 100644 Tests/Resources/metric-kit-callstack-tree-simple.json create mode 100644 Tests/Resources/metric-kit-callstack-tree-unknown-fields.json create mode 100644 Tests/SentryTests/Integrations/MetricKit/SentryMXCallStackTreeTests.swift create mode 100644 Tests/SentryTests/Integrations/MetricKit/SentryMetricKitIntegrationTests.swift diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index c1c94c626d4..7f48d852725 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -16,6 +16,8 @@ 637AFDB3243B02770034958B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 637AFDB2243B02770034958B /* Assets.xcassets */; }; 637AFDB6243B02770034958B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 637AFDB4243B02770034958B /* LaunchScreen.storyboard */; }; 7B3427F825876A5200056519 /* Tongariro.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 7B3427F725876A5200056519 /* Tongariro.jpg */; }; + 7B5525B32938B5B5006A2932 /* DiskWriteException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B5525B22938B5B5006A2932 /* DiskWriteException.swift */; }; + 7B5525B62938B644006A2932 /* DiskWriteException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B5525B22938B5B5006A2932 /* DiskWriteException.swift */; }; 7B64386B26A6C544000D0F65 /* LaunchUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B64386A26A6C544000D0F65 /* LaunchUITests.swift */; }; 7B79000429028C7300A7F467 /* MetricKitManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B79000329028C7300A7F467 /* MetricKitManager.swift */; }; 7BFC8B0626D4D24B000D3504 /* LoremIpsum.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7BFC8B0526D4D24B000D3504 /* LoremIpsum.txt */; }; @@ -245,6 +247,7 @@ 7B3427F725876A5200056519 /* Tongariro.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Tongariro.jpg; sourceTree = ""; }; 7B4F33F7271EBD2500C8591E /* SwiftUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUI.swift; sourceTree = ""; }; 7B4F33FA271EBE0C00C8591E /* SwiftUIViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIViewController.swift; sourceTree = ""; }; + 7B5525B22938B5B5006A2932 /* DiskWriteException.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiskWriteException.swift; sourceTree = ""; }; 7B64386826A6C544000D0F65 /* iOS-SwiftUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "iOS-SwiftUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 7B64386A26A6C544000D0F65 /* LaunchUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchUITests.swift; sourceTree = ""; }; 7B64386C26A6C544000D0F65 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -511,6 +514,7 @@ D8D7BB492750067900044146 /* UIAssert.swift */, D8D7BB4D27501B9400044146 /* SpanObserver.swift */, 84FB812C2840021B00F3A94A /* iOS-Swift-Bridging-Header.h */, + 7B5525B22938B5B5006A2932 /* DiskWriteException.swift */, ); path = Tools; sourceTree = ""; @@ -809,6 +813,7 @@ D8444E4C275E38090042F4DE /* UIViewControllerExtension.swift in Sources */, 637AFDAE243B02760034958B /* ViewController.swift in Sources */, 0AABE2EA28855FF80057ED69 /* PermissionsViewController.swift in Sources */, + 7B5525B32938B5B5006A2932 /* DiskWriteException.swift in Sources */, 84FB8120283EEDB900F3A94A /* PerformanceViewController.swift in Sources */, D8F3D062274EBD4800B56F8C /* SpanExtension.swift in Sources */, 637AFDAA243B02760034958B /* AppDelegate.swift in Sources */, @@ -858,6 +863,7 @@ D8269A4F274C09A400BD5BD5 /* SwiftUI.swift in Sources */, D8444E57275F795D0042F4DE /* UIViewControllerExtension.swift in Sources */, D8F3D058274E57D600B56F8C /* TableViewController.swift in Sources */, + 7B5525B62938B644006A2932 /* DiskWriteException.swift in Sources */, D8269A58274C0FC700BD5BD5 /* ViewController.swift in Sources */, 844DA821282584C300E6B62E /* CoreDataViewController.swift in Sources */, D8444E55275F79570042F4DE /* SpanExtension.swift in Sources */, diff --git a/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift b/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift index eb0d35b2004..a75b8981e05 100644 --- a/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift +++ b/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift @@ -19,6 +19,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return event } options.debug = true + if #available(iOS 14.0, *) { + options.enableMetricKit = true + } // Sampling 100% - In Production you probably want to adjust this options.tracesSampleRate = 1.0 options.sessionTrackingIntervalMillis = 5_000 diff --git a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard index f835a859630..c5caddff8b0 100644 --- a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard +++ b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard @@ -18,13 +18,13 @@ - + - + - + - + +