Skip to content

Commit

Permalink
Removing experimentalEnableTraceSampling
Browse files Browse the repository at this point in the history
  • Loading branch information
brustolin committed Jul 7, 2022
1 parent 1e20433 commit 4be64fb
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 46 deletions.
7 changes: 0 additions & 7 deletions Sources/Sentry/Public/SentryOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,6 @@ NS_SWIFT_NAME(Options)
*/
@property (nullable, nonatomic, weak) id<NSURLSessionDelegate> urlSessionDelegate;

/**
* Controls if the `tracestate` header is attached to envelopes and HTTP client integrations.
*
* Note: this is an experimental API and will be removed without notice.
*/
@property (nonatomic) BOOL experimentalEnableTraceSampling;

/**
* Wether the SDK should use swizzling or not. Default is YES.
*
Expand Down
8 changes: 2 additions & 6 deletions Sources/Sentry/SentryClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,7 @@ - (SentryId *)sendEvent:(SentryEvent *)event
isCrashEvent:isCrashEvent];

if (nil != preparedEvent) {
SentryTraceContext *traceContext = _options.experimentalEnableTraceSampling
? [self getTraceStateWithEvent:event withScope:scope]
: nil;
SentryTraceContext *traceContext = [self getTraceStateWithEvent:event withScope:scope];

NSArray *attachments = scope.attachments;
if (self.attachmentProcessor)
Expand Down Expand Up @@ -338,9 +336,7 @@ - (SentryId *)sendEvent:(SentryEvent *)event
attachments = [self.attachmentProcessor processAttachments:attachments forEvent:event];

if (nil == session.releaseName || [session.releaseName length] == 0) {
SentryTraceContext *traceContext = _options.experimentalEnableTraceSampling
? [self getTraceStateWithEvent:event withScope:scope]
: nil;
SentryTraceContext *traceContext = [self getTraceStateWithEvent:event withScope:scope];

[SentryLog logWithMessage:DropSessionLogMessage andLevel:kSentryLevelDebug];

Expand Down
4 changes: 0 additions & 4 deletions Sources/Sentry/SentryOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ - (instancetype)init
_defaultTracesSampleRate = nil;
self.tracesSampleRate = _defaultTracesSampleRate;
self.enableCoreDataTracking = NO;
_experimentalEnableTraceSampling = NO;
_enableSwizzling = YES;
#if SENTRY_TARGET_PROFILING_SUPPORTED
self.enableProfiling = NO;
Expand Down Expand Up @@ -285,9 +284,6 @@ - (BOOL)validateOptions:(NSDictionary<NSString *, id> *)options
self.urlSessionDelegate = options[@"urlSessionDelegate"];
}

[self setBool:options[@"experimentalEnableTraceSampling"]
block:^(BOOL value) { self->_experimentalEnableTraceSampling = value; }];

[self setBool:options[@"enableSwizzling"]
block:^(BOOL value) { self->_enableSwizzling = value; }];

Expand Down
10 changes: 0 additions & 10 deletions Tests/SentryTests/SentryClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1039,28 +1039,18 @@ class SentryClientTest: XCTestCase {
func testCaptureTransactionEvent_sendTraceState() {
let transaction = fixture.transaction
let client = fixture.getSut()
client.options.experimentalEnableTraceSampling = true
client.capture(event: transaction)

XCTAssertNotNil(fixture.transportAdapter.sendEventWithTraceStateInvocations.first?.traceContext)
}

func testCaptureTransactionEvent_dontSendTraceState() {
let transaction = fixture.transaction
let client = fixture.getSut()
client.capture(event: transaction)

XCTAssertNil(fixture.transportAdapter.sendEventWithTraceStateInvocations.first?.traceContext)
}

func testCaptureEvent_traceInScope_sendTraceState() {
let event = Event(level: SentryLevel.warning)
event.message = fixture.message
let scope = Scope()
scope.span = fixture.trace

let client = fixture.getSut()
client.options.experimentalEnableTraceSampling = true
client.capture(event: event, scope: scope)

client.capture(event: event)
Expand Down
19 changes: 0 additions & 19 deletions Tests/SentryTests/SentryOptionsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -440,24 +440,6 @@ - (void)testEnableIOTracking
[self testBooleanField:@"enableFileIOTracking" defaultValue:NO];
}

- (void)testEnableTraceSampling
{
SentryOptions *options = [self getValidOptions:@{}];
XCTAssertFalse(options.experimentalEnableTraceSampling);
}

- (void)testEnableTraceSamplingEnabled
{
SentryOptions *options = [self getValidOptions:@{ @"experimentalEnableTraceSampling" : @YES }];
XCTAssertTrue(options.experimentalEnableTraceSampling);
}

- (void)testEnableTraceSamplingDisabled
{
SentryOptions *options = [self getValidOptions:@{ @"experimentalEnableTraceSampling" : @NO }];
XCTAssertFalse(options.experimentalEnableTraceSampling);
}

- (void)testEmptyConstructorSetsDefaultValues
{
SentryOptions *options = [[SentryOptions alloc] init];
Expand Down Expand Up @@ -551,7 +533,6 @@ - (void)assertDefaultValues:(SentryOptions *)options
XCTAssertEqualObjects([self getDefaultInAppIncludes], options.inAppIncludes);
XCTAssertEqual(@[], options.inAppExcludes);
XCTAssertNil(options.urlSessionDelegate);
XCTAssertFalse(options.experimentalEnableTraceSampling);
XCTAssertEqual(YES, options.enableSwizzling);
XCTAssertEqual(NO, options.enableFileIOTracking);
#if SENTRY_TARGET_PROFILING_SUPPORTED
Expand Down

0 comments on commit 4be64fb

Please sign in to comment.