Skip to content

Commit f128ee1

Browse files
authored
Merge 8a4f0d0 into 56c9730
2 parents 56c9730 + 8a4f0d0 commit f128ee1

File tree

9 files changed

+19
-23
lines changed

9 files changed

+19
-23
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+
- Mark [SpanProtocol setExtraValue:forKey] as deprecated (#2413)
10+
711
### Features
812

913
- Properly demangle Swift class name (#2162)

Sources/Sentry/Public/SentrySpanProtocol.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ NS_SWIFT_NAME(Span)
7070
* Use setDataValue instead. This method calls setDataValue, was added by mistake, and will be
7171
* deprecated in a future version.
7272
*/
73-
- (void)setExtraValue:(nullable id)value forKey:(NSString *)key NS_SWIFT_NAME(setExtra(value:key:));
73+
- (void)setExtraValue:(nullable id)value
74+
forKey:(NSString *)key DEPRECATED_ATTRIBUTE NS_SWIFT_NAME(setExtra(value:key:));
7475

7576
/**
7677
* Removes a data value.

Sources/Sentry/SentryNoOpSpan.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ SENTRY_NO_INIT
1717
@property (nullable, readonly) NSDictionary<NSString *, id> *data;
1818
@property (readonly) NSDictionary<NSString *, NSString *> *tags;
1919

20+
- (void)setExtraValue:(nullable id)value forKey:(NSString *)key DEPRECATED_ATTRIBUTE;
2021
@end
2122

2223
NS_ASSUME_NONNULL_END

Sources/Sentry/include/SentrySpan.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ SENTRY_NO_INIT
4545
*/
4646
- (instancetype)initWithTracer:(SentryTracer *)transaction context:(SentrySpanContext *)context;
4747

48+
- (void)setExtraValue:(nullable id)value forKey:(NSString *)key DEPRECATED_ATTRIBUTE;
4849
@end
4950

5051
NS_ASSUME_NONNULL_END

Sources/Sentry/include/SentryTracer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ static NSTimeInterval const SentryTracerDefaultTimeout = 3.0;
143143
*/
144144
- (void)spanFinished:(id<SentrySpan>)finishedSpan;
145145

146+
- (void)setExtraValue:(nullable id)value forKey:(NSString *)key DEPRECATED_ATTRIBUTE;
147+
146148
/**
147149
* Get the tracer from a span.
148150
*/

Tests/SentryTests/Performance/SentryTracerTests.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -810,13 +810,6 @@ class SentryTracerTests: XCTestCase {
810810
}
811811
#endif
812812

813-
func testSetExtra_ForwardsToSetData() {
814-
let sut = fixture.getSut()
815-
sut.setExtra(value: 0, key: "key")
816-
817-
XCTAssertEqual(["key": 0], sut.data as! [String: Int])
818-
}
819-
820813
func testTagsFromContext_shouldBeSerialized() {
821814
// given
822815
fixture.transactionContext.setTag(value: fixture.testValue, key: fixture.testKey)

Tests/SentryTests/Transaction/SentryNoOpSpanTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class SentryNoOpSpanTests: XCTestCase {
2727
let sut = SentryNoOpSpan.shared()
2828
XCTAssertNil(sut.data)
2929
sut.setData(value: "tet", key: "key")
30-
sut.setExtra(value: "tet", key: "key")
3130
sut.removeData(key: "any")
3231
XCTAssertNil(sut.data)
3332
}

Tests/SentryTests/Transaction/SentrySpanTests.swift

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ class SentrySpanTests: XCTestCase {
185185
XCTAssertFalse(logOutput.loggedMessages.filter({ $0.contains(" Starting a child on a finished span is not supported; it won\'t be sent to Sentry.") }).isEmpty)
186186
}
187187

188-
func testAddAndRemoveExtras() {
188+
func testAddAndRemoveData() {
189189
let span = fixture.getSut()
190190

191-
span.setExtra(value: fixture.extraValue, key: fixture.extraKey)
191+
span.setData(value: fixture.extraValue, key: fixture.extraKey)
192192

193193
XCTAssertEqual(span.data!.count, 1)
194194
XCTAssertEqual(span.data![fixture.extraKey] as! String, fixture.extraValue)
@@ -214,7 +214,7 @@ class SentrySpanTests: XCTestCase {
214214
func testSerialization() {
215215
let span = fixture.getSut()
216216

217-
span.setExtra(value: fixture.extraValue, key: fixture.extraKey)
217+
span.setData(value: fixture.extraValue, key: fixture.extraKey)
218218
span.setTag(value: fixture.extraValue, key: fixture.extraKey)
219219
span.finish()
220220

@@ -234,7 +234,7 @@ class SentrySpanTests: XCTestCase {
234234
func testSanitizeData() {
235235
let span = fixture.getSut()
236236

237-
span.setExtra(value: Date(timeIntervalSince1970: 10), key: "date")
237+
span.setData(value: Date(timeIntervalSince1970: 10), key: "date")
238238
span.finish()
239239

240240
let serialization = span.serialize()
@@ -244,7 +244,7 @@ class SentrySpanTests: XCTestCase {
244244
func testSanitizeDataSpan() {
245245
let span = SentrySpan(tracer: fixture.tracer, context: SpanContext(operation: fixture.someOperation, sampled: .undecided))
246246

247-
span.setExtra(value: Date(timeIntervalSince1970: 10), key: "date")
247+
span.setData(value: Date(timeIntervalSince1970: 10), key: "date")
248248
span.finish()
249249

250250
let serialization = span.serialize()
@@ -304,14 +304,7 @@ class SentrySpanTests: XCTestCase {
304304
XCTAssertEqual(header.sampled, .undecided)
305305
XCTAssertEqual(header.value(), "\(span.context.traceId)-\(span.context.spanId)")
306306
}
307-
308-
func testSetExtra_ForwardsToSetData() {
309-
let sut = SentrySpan(tracer: fixture.tracer, context: SpanContext(operation: "test"))
310-
sut.setExtra(value: 0, key: "key")
311-
312-
XCTAssertEqual(["key": 0], sut.data as! [String: Int])
313-
}
314-
307+
315308
func testSpanWithoutTracer_StartChild_ReturnsNoOpSpan() {
316309
// Span has a weak reference to tracer. If we don't keep a reference
317310
// to the tracer ARC will deallocate the tracer.
@@ -349,7 +342,7 @@ class SentrySpanTests: XCTestCase {
349342
queue.async {
350343

351344
for j in 0..<innerLoop {
352-
span.setExtra(value: value, key: "\(i)-\(j)")
345+
span.setData(value: value, key: "\(i)-\(j)")
353346
span.setTag(value: value, key: "\(i)-\(j)")
354347
}
355348

Tests/SentryTests/Transaction/TestSentrySpan.h

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

55
@interface TestSentrySpan : NSObject <SentrySpan>
66

7+
- (void)setExtraValue:(nullable id)value forKey:(nonnull NSString *)key DEPRECATED_ATTRIBUTE;
8+
79
@end
810

911
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)