Skip to content

Commit 5fc3364

Browse files
fix: Remove not needed debug meta fields (#6512)
Remove uuid and name from SentryDebugMeta as they aren't available in the protocol and we kept them for backwards compatibility since #2701. Fixes GH-2702
1 parent debf3e9 commit 5fc3364

File tree

11 files changed

+14
-256
lines changed

11 files changed

+14
-256
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- Removes `enablePerformanceV2` option and makes this the default. The app start duration will now finish when the first frame is drawn instead of when the OS posts the UIWindowDidBecomeVisibleNotification. (#6008)
1616
- Removes enableTracing property from SentryOptions (#5694)
1717
- Structured Logs: Move options out of experimental (#6359)
18+
- Remove `uuid` and `name` of `SentryDebugMeta` (#6512) Use `debugID` instead of `uuid` and `codeFile` instead of `name`.
1819
- Enable enablePreWarmedAppStartTracing by default (#6508). With this option enabled, the SDK collects [prewarmed app starts](https://docs.sentry.io/platforms/apple/tracing/instrumentation/automatic-instrumentation/#prewarmed-app-start-tracing).
1920

2021
### Features

Sources/Sentry/Public/SentryDebugMeta.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ NS_SWIFT_NAME(DebugMeta)
2727
<SentrySerializable>
2828
#endif
2929

30-
/**
31-
* The UUID of the image. Use @c debugID when using "macho" as the @c type .
32-
*/
33-
@property (nonatomic, copy) NSString *_Nullable uuid;
34-
3530
/**
3631
* Identifier of the dynamic library or executable. It is the value of the @c LC_UUID load command
3732
* in the Mach header, formatted as UUID.
@@ -43,11 +38,6 @@ NS_SWIFT_NAME(DebugMeta)
4338
*/
4439
@property (nonatomic, copy) NSString *_Nullable type;
4540

46-
/**
47-
* Name of the image. Use @c codeFile when using "macho" as the @c type .
48-
*/
49-
@property (nullable, nonatomic, copy) NSString *name;
50-
5141
/**
5242
* The size of the image in virtual memory. If missing, Sentry will assume that the image spans up
5343
* to the next image, which might lead to invalid stack traces.

Sources/Sentry/SentryDebugMeta.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ - (instancetype)init
1313
{
1414
NSMutableDictionary *serializedData = [NSMutableDictionary new];
1515

16-
serializedData[@"uuid"] = self.uuid;
1716
serializedData[@"debug_id"] = self.debugID;
1817
serializedData[@"type"] = self.type;
1918
serializedData[@"image_addr"] = self.imageAddress;
2019
serializedData[@"image_size"] = self.imageSize;
21-
serializedData[@"name"] = [self.name lastPathComponent];
2220
serializedData[@"code_file"] = self.codeFile;
2321
serializedData[@"image_vmaddr"] = self.imageVmAddress;
2422

Sources/Swift/Protocol/Codable/SentryDebugMetaCodable.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ typealias DebugMetaDecodable = DebugMeta
1313
extension DebugMetaDecodable: Decodable {
1414

1515
private enum CodingKeys: String, CodingKey {
16-
case uuid
1716
case debugID = "debug_id"
1817
case type
19-
case name
2018
case imageSize = "image_size"
2119
case imageAddress = "image_addr"
2220
case imageVmAddress = "image_vmaddr"
@@ -33,11 +31,9 @@ extension DebugMetaDecodable: Decodable {
3331
let container = try decoder.container(keyedBy: CodingKeys.self)
3432

3533
self.init()
36-
37-
self.uuid = try container.decodeIfPresent(String.self, forKey: .uuid)
34+
3835
self.debugID = try container.decodeIfPresent(String.self, forKey: .debugID)
3936
self.type = try container.decodeIfPresent(String.self, forKey: .type)
40-
self.name = try container.decodeIfPresent(String.self, forKey: .name)
4137
self.imageSize = (try container.decodeIfPresent(NSNumberDecodableWrapper.self, forKey: .imageSize))?.value
4238
self.imageAddress = try container.decodeIfPresent(String.self, forKey: .imageAddress)
4339
self.imageVmAddress = try container.decodeIfPresent(String.self, forKey: .imageVmAddress)

Tests/SentryProfilerTests/SentryProfileTestFixture.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class SentryProfileTestFixture {
5757
SentryDependencyContainer.sharedInstance().timerFactory = timeoutTimerFactory
5858

5959
let image = DebugMeta()
60-
image.name = "sentrytest"
6160
image.imageAddress = "0x0000000105705000"
6261
image.imageVmAddress = "0x0000000105705000"
6362
image.codeFile = "codeFile"

Tests/SentryTests/Integrations/ANR/SentryANRTrackingIntegrationTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class SentryANRTrackingIntegrationTests: SentrySDKIntegrationTestsBase {
119119

120120
XCTAssertEqual(event?.debugMeta?.count, 1)
121121
let eventDebugImage = try XCTUnwrap(event?.debugMeta?.first)
122-
XCTAssertEqual(eventDebugImage.uuid, TestData.debugImage.uuid)
122+
XCTAssertEqual(eventDebugImage.debugID, TestData.debugImage.debugID)
123123
}
124124
}
125125

@@ -160,7 +160,7 @@ class SentryANRTrackingIntegrationTests: SentrySDKIntegrationTestsBase {
160160

161161
XCTAssertEqual(event?.debugMeta?.count, 1)
162162
let eventDebugImage = try XCTUnwrap(event?.debugMeta?.first)
163-
XCTAssertEqual(eventDebugImage.uuid, TestData.debugImage.uuid)
163+
XCTAssertEqual(eventDebugImage.debugID, TestData.debugImage.debugID)
164164
}
165165
}
166166

@@ -202,7 +202,7 @@ class SentryANRTrackingIntegrationTests: SentrySDKIntegrationTestsBase {
202202

203203
XCTAssertEqual(event?.debugMeta?.count, 1)
204204
let eventDebugImage = try XCTUnwrap(event?.debugMeta?.first)
205-
XCTAssertEqual(eventDebugImage.uuid, TestData.debugImage.uuid)
205+
XCTAssertEqual(eventDebugImage.debugID, TestData.debugImage.debugID)
206206
}
207207
}
208208

@@ -244,7 +244,7 @@ class SentryANRTrackingIntegrationTests: SentrySDKIntegrationTestsBase {
244244

245245
XCTAssertEqual(event?.debugMeta?.count, 1)
246246
let eventDebugImage = try XCTUnwrap(event?.debugMeta?.first)
247-
XCTAssertEqual(eventDebugImage.uuid, TestData.debugImage.uuid)
247+
XCTAssertEqual(eventDebugImage.debugID, TestData.debugImage.debugID)
248248
}
249249
}
250250

@@ -401,7 +401,7 @@ class SentryANRTrackingIntegrationTests: SentrySDKIntegrationTestsBase {
401401

402402
XCTAssertEqual(event?.debugMeta?.count, 1)
403403
let eventDebugImage = try XCTUnwrap(event?.debugMeta?.first)
404-
XCTAssertEqual(eventDebugImage.uuid, TestData.debugImage.uuid)
404+
XCTAssertEqual(eventDebugImage.debugID, TestData.debugImage.debugID)
405405

406406
let tags = try XCTUnwrap(event?.tags)
407407
XCTAssertEqual(1, tags.count)
@@ -460,7 +460,7 @@ class SentryANRTrackingIntegrationTests: SentrySDKIntegrationTestsBase {
460460

461461
XCTAssertEqual(event?.debugMeta?.count, 1)
462462
let eventDebugImage = try XCTUnwrap(event?.debugMeta?.first)
463-
XCTAssertEqual(eventDebugImage.uuid, TestData.debugImage.uuid)
463+
XCTAssertEqual(eventDebugImage.debugID, TestData.debugImage.debugID)
464464

465465
let tags = try XCTUnwrap(event?.tags)
466466
XCTAssertEqual(1, tags.count)

Tests/SentryTests/Protocol/SentryDebugMetaEquality.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ import Foundation
33
extension DebugMeta {
44
open override func isEqual(_ object: Any?) -> Bool {
55
if let other = object as? DebugMeta {
6-
return uuid == other.uuid &&
7-
debugID == other.debugID &&
6+
return debugID == other.debugID &&
87
type == other.type &&
9-
name == other.name &&
108
codeFile == other.codeFile &&
119
imageSize == other.imageSize &&
1210
imageAddress == other.imageAddress &&

Tests/SentryTests/Protocol/SentryDebugMetaTests.swift

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ class SentryDebugMetaTests: XCTestCase {
1111
let actual = debugMeta.serialize()
1212

1313
// Assert
14-
XCTAssertEqual(debugMeta.uuid, actual["uuid"] as? String)
1514
XCTAssertEqual(debugMeta.debugID, actual["debug_id"] as? String)
1615
XCTAssertEqual(debugMeta.type, actual["type"] as? String)
1716
XCTAssertEqual(debugMeta.imageAddress, actual["image_addr"] as? String)
1817
XCTAssertEqual(debugMeta.imageSize, actual["image_size"] as? NSNumber)
19-
XCTAssertEqual((debugMeta.name! as NSString).lastPathComponent, actual["name"] as? String)
2018
XCTAssertEqual(debugMeta.codeFile, actual["code_file"] as? String)
2119
XCTAssertEqual(debugMeta.imageVmAddress, actual["image_vmaddr"] as? String)
2220
}
@@ -31,12 +29,10 @@ class SentryDebugMetaTests: XCTestCase {
3129
let decoded = try XCTUnwrap(decodeFromJSONData(jsonData: data) as DebugMetaDecodable?)
3230

3331
// Assert
34-
XCTAssertEqual(debugMeta.uuid, decoded.uuid)
3532
XCTAssertEqual(debugMeta.debugID, decoded.debugID)
3633
XCTAssertEqual(debugMeta.type, decoded.type)
3734
XCTAssertEqual(debugMeta.imageAddress, decoded.imageAddress)
3835
XCTAssertEqual(debugMeta.imageSize, decoded.imageSize)
39-
XCTAssertEqual((debugMeta.name! as NSString).lastPathComponent, decoded.name)
4036
XCTAssertEqual(debugMeta.codeFile, decoded.codeFile)
4137
XCTAssertEqual(debugMeta.imageVmAddress, decoded.imageVmAddress)
4238
}
@@ -51,33 +47,29 @@ class SentryDebugMetaTests: XCTestCase {
5147
let decoded = try XCTUnwrap(decodeFromJSONData(jsonData: data) as DebugMetaDecodable?)
5248

5349
// Assert
54-
XCTAssertNil(decoded.uuid)
5550
XCTAssertNil(decoded.debugID)
5651
XCTAssertNil(decoded.type)
5752
XCTAssertNil(decoded.imageAddress)
5853
XCTAssertNil(decoded.imageSize)
59-
XCTAssertNil(decoded.name)
6054
XCTAssertNil(decoded.codeFile)
6155
XCTAssertNil(decoded.imageVmAddress)
6256
}
6357

64-
func testDecode_WithOnlyUuid() throws {
58+
func testDecode_WithOnlyDebugID() throws {
6559
// Arrange
6660
let debugMeta = DebugMeta()
67-
debugMeta.uuid = "123"
61+
debugMeta.debugID = "123"
6862
let actual = debugMeta.serialize()
6963
let data = try XCTUnwrap(SentrySerializationSwift.data(withJSONObject: actual))
7064

7165
// Act
7266
let decoded = try XCTUnwrap(decodeFromJSONData(jsonData: data) as DebugMetaDecodable?)
7367

7468
// Assert
75-
XCTAssertEqual(debugMeta.uuid, decoded.uuid)
76-
XCTAssertNil(decoded.debugID)
69+
XCTAssertEqual(debugMeta.debugID, decoded.debugID)
7770
XCTAssertNil(decoded.type)
7871
XCTAssertNil(decoded.imageAddress)
7972
XCTAssertNil(decoded.imageSize)
80-
XCTAssertNil(decoded.name)
8173
XCTAssertNil(decoded.codeFile)
8274
XCTAssertNil(decoded.imageVmAddress)
8375
}

Tests/SentryTests/Protocol/TestData.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@ class TestData {
8585
debugMeta.imageAddress = "0x0000000105705000"
8686
debugMeta.imageSize = 352_256
8787
debugMeta.imageVmAddress = "0x00007fff51af0000"
88-
debugMeta.name = "/tmp/scratch/dyld_sim"
8988
debugMeta.codeFile = "/tmp/scratch/dyld_sim"
9089
debugMeta.type = "macho"
91-
debugMeta.uuid = "84BAEBDA-AD1A-33F4-B35D-8A45F5DAF322"
9290
debugMeta.debugID = "84BAEBDA-AD1A-33F4-B35D-8A45F5DAF321"
9391

9492
return debugMeta
@@ -244,7 +242,7 @@ class TestData {
244242

245243
static var debugImage: DebugMeta {
246244
let image = DebugMeta()
247-
image.name = "sentrytest"
245+
image.codeFile = "sentrytest"
248246
image.imageAddress = "0x0000000105705000"
249247
image.imageVmAddress = "0x0000000105705000"
250248
return image

Tests/SentryTests/SentryClientTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,7 @@ private extension SentryClientTests {
22482248
private func givenEventWithDebugMeta() -> Event {
22492249
let event = Event(level: SentryLevel.fatal)
22502250
let debugMeta = DebugMeta()
2251-
debugMeta.name = "Me"
2251+
debugMeta.codeFile = "Me"
22522252
let debugMetas = [debugMeta]
22532253
event.debugMeta = debugMetas
22542254
return event

0 commit comments

Comments
 (0)