Skip to content

Commit ee03e12

Browse files
authored
Merge 874e78a into 56c9730
2 parents 56c9730 + 874e78a commit ee03e12

File tree

9 files changed

+20
-16
lines changed

9 files changed

+20
-16
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
This version introduces a dependency on Swift, which only impacts you if you don't use Swift. If your project uses Swift already, this change will not affect you.
66

7+
### Breaking Changes
8+
9+
- Make SpanProtocol.data non nullable (#2409)
10+
711
### Features
812

913
- Properly demangle Swift class name (#2162)

Samples/iOS-Swift/iOS-Swift/ViewControllers/TraceTestViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class TraceTestViewController: UIViewController {
7272
return
7373
}
7474

75-
UIAssert.isEqual(child.data?["url"] as? String, "/sentry-logo-black.png", "Could not read url data value")
75+
UIAssert.isEqual(child.data["url"] as? String, "/sentry-logo-black.png", "Could not read url data value")
7676

7777
UIAssert.isEqual(child.tags["http.status_code"], "200", "Could not read status_code tag value")
7878

Sources/Sentry/Public/SentrySpanProtocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ NS_SWIFT_NAME(Span)
2727
/**
2828
* An arbitrary mapping of additional metadata of the span.
2929
*/
30-
@property (nullable, readonly) NSDictionary<NSString *, id> *data;
30+
@property (readonly) NSDictionary<NSString *, id> *data;
3131

3232
/**
3333
* key-value pairs holding additional data about the span.

Sources/Sentry/SentrySpan.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ - (void)removeDataForKey:(NSString *)key
7474
}
7575
}
7676

77-
- (nullable NSDictionary<NSString *, id> *)data
77+
- (NSDictionary<NSString *, id> *)data
7878
{
7979
@synchronized(_data) {
8080
return [_data copy];

Sources/Sentry/SentryTracer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ - (void)setStartTimestamp:(nullable NSDate *)startTimestamp
325325
#endif
326326
}
327327

328-
- (nullable NSDictionary<NSString *, id> *)data
328+
- (NSDictionary<NSString *, id> *)data
329329
{
330330
@synchronized(_data) {
331331
return [_data copy];

Tests/SentryTests/Integrations/Performance/CoreData/SentryCoreDataTrackerTest.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class SentryCoreDataTrackerTests: XCTestCase {
151151

152152
XCTAssertEqual(transaction.children.count, 1)
153153

154-
guard let operations = transaction.children[0].data?["operations"] as? [String: Any?] else {
154+
guard let operations = transaction.children[0].data["operations"] as? [String: Any?] else {
155155
XCTFail("Transaction has no `operations` extra")
156156
return
157157
}
@@ -230,7 +230,7 @@ class SentryCoreDataTrackerTests: XCTestCase {
230230
XCTAssertEqual(transaction.children.count, 1)
231231
XCTAssertEqual(transaction.children[0].context.operation, SENTRY_COREDATA_FETCH_OPERATION)
232232
XCTAssertEqual(transaction.children[0].context.spanDescription, expectedDescription)
233-
XCTAssertEqual(transaction.children[0].data!["read_count"] as? Int, 1)
233+
XCTAssertEqual(transaction.children[0].data["read_count"] as? Int, 1)
234234
}
235235

236236
private func startTransaction() -> SentryTracer {

Tests/SentryTests/Integrations/Performance/IO/SentryNSDataTrackerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ class SentryNSDataTrackerTests: XCTestCase {
224224
XCTAssertNotNil(span)
225225
XCTAssertEqual(span?.context.operation, operation)
226226
XCTAssertTrue(span?.isFinished ?? false)
227-
XCTAssertEqual(span?.data?["file.size"] as? Int, size)
228-
XCTAssertEqual(span?.data?["file.path"] as? String, path)
227+
XCTAssertEqual(span?.data["file.size"] as? Int, size)
228+
XCTAssertEqual(span?.data["file.path"] as? String, path)
229229

230230
let lastComponent = (path as NSString).lastPathComponent
231231

Tests/SentryTests/Integrations/Performance/Network/SentryNetworkTrackerTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,9 @@ class SentryNetworkTrackerTests: XCTestCase {
752752
XCTAssertNil(httpStatusCode)
753753
}
754754

755-
let path = span.data!["url"] as? String
756-
let method = span.data!["method"] as? String
757-
let requestType = span.data!["type"] as? String
755+
let path = span.data["url"] as? String
756+
let method = span.data["method"] as? String
757+
let requestType = span.data["type"] as? String
758758

759759
XCTAssertEqual(path, task.currentRequest!.url!.path)
760760
XCTAssertEqual(method, task.currentRequest!.httpMethod)

Tests/SentryTests/Transaction/SentrySpanTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,12 @@ class SentrySpanTests: XCTestCase {
190190

191191
span.setExtra(value: fixture.extraValue, key: fixture.extraKey)
192192

193-
XCTAssertEqual(span.data!.count, 1)
194-
XCTAssertEqual(span.data![fixture.extraKey] as! String, fixture.extraValue)
193+
XCTAssertEqual(span.data.count, 1)
194+
XCTAssertEqual(span.data[fixture.extraKey] as! String, fixture.extraValue)
195195

196196
span.removeData(key: fixture.extraKey)
197-
XCTAssertEqual(span.data!.count, 0)
198-
XCTAssertNil(span.data![fixture.extraKey])
197+
XCTAssertEqual(span.data.count, 0)
198+
XCTAssertNil(span.data[fixture.extraKey])
199199
}
200200

201201
func testAddAndRemoveTags() {
@@ -359,7 +359,7 @@ class SentrySpanTests: XCTestCase {
359359

360360
queue.activate()
361361
group.wait()
362-
XCTAssertEqual(span.data!.count, outerLoop * innerLoop)
362+
XCTAssertEqual(span.data.count, outerLoop * innerLoop)
363363
}
364364

365365
func testSpanStatusNames() {

0 commit comments

Comments
 (0)