Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
getsentry-bot committed Oct 25, 2022
1 parent a78999b commit 411f5ab
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Sources/Sentry/SentryProfiler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ + (void)captureEnvelopeIfFinished:(SentryProfiler *)profiler spanID:(SentrySpanI
[profiler captureEnvelope];
[profiler->_transactions removeAllObjects];
} else {
SENTRY_LOG_DEBUG(@"Profiler %@ is waiting for more spans to complete: %@.", profiler, profiler->_spansInFlight);
SENTRY_LOG_DEBUG(@"Profiler %@ is waiting for more spans to complete: %@.", profiler,
profiler->_spansInFlight);
}
}

Expand Down
3 changes: 2 additions & 1 deletion Sources/Sentry/SentrySpan.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ - (void)finishWithStatus:(SentrySpanStatus)status
self.timestamp = [SentryCurrentDate date];
}
if (self.tracer == nil) {
SENTRY_LOG_DEBUG(@"No tracer associated with span with id %@", _context.spanId.sentrySpanIdString);
SENTRY_LOG_DEBUG(
@"No tracer associated with span with id %@", _context.spanId.sentrySpanIdString);
return;
}
[self.tracer spanFinished:self];
Expand Down
18 changes: 12 additions & 6 deletions Sources/Sentry/SentryTracer.m
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ - (void)cancelIdleTimeout
context.spanDescription = description;

SentrySpan *child = [[SentrySpan alloc] initWithTracer:self context:context];
SENTRY_LOG_DEBUG(@"Started child span %@ under %@", child.context.spanId.sentrySpanIdString, parentId.sentrySpanIdString);
SENTRY_LOG_DEBUG(@"Started child span %@ under %@", child.context.spanId.sentrySpanIdString,
parentId.sentrySpanIdString);
@synchronized(_children) {
[_children addObject:child];
}
Expand All @@ -275,7 +276,8 @@ - (void)spanFinished:(id<SentrySpan>)finishedSpan
// Calling canBeFinished on the rootSpan would end up in an endless loop because canBeFinished
// calls finish on the rootSpan.
if (finishedSpan == self.rootSpan) {
SENTRY_LOG_DEBUG(@"Cannot call finish on root span with id %@", finishedSpan.context.spanId.sentrySpanIdString);
SENTRY_LOG_DEBUG(@"Cannot call finish on root span with id %@",
finishedSpan.context.spanId.sentrySpanIdString);
return;
}
[self canBeFinished];
Expand Down Expand Up @@ -417,20 +419,24 @@ - (void)canBeFinished
// Transaction already finished and captured.
// Sending another transaction and spans with
// the same SentryId would be an error.
if (self.rootSpan.isFinished){
SENTRY_LOG_DEBUG(@"Root span with id %@ is already finished", self.rootSpan.context.spanId.sentrySpanIdString);
if (self.rootSpan.isFinished) {
SENTRY_LOG_DEBUG(@"Root span with id %@ is already finished",
self.rootSpan.context.spanId.sentrySpanIdString);
return;
}

BOOL hasUnfinishedChildSpansToWaitFor = [self hasUnfinishedChildSpansToWaitFor];
if (!self.wasFinishCalled && !hasUnfinishedChildSpansToWaitFor && [self hasIdleTimeout]) {
SENTRY_LOG_DEBUG(@"Root span with id %@ isn't waiting on children and needs idle timeout dispatched.", self.rootSpan.context.spanId.sentrySpanIdString);
SENTRY_LOG_DEBUG(
@"Root span with id %@ isn't waiting on children and needs idle timeout dispatched.",
self.rootSpan.context.spanId.sentrySpanIdString);
[self dispatchIdleTimeout];
return;
}

if (!self.wasFinishCalled || hasUnfinishedChildSpansToWaitFor) {
SENTRY_LOG_DEBUG(@"Root span with id %@ has children but isn't waiting for them right now.", self.rootSpan.context.spanId.sentrySpanIdString);
SENTRY_LOG_DEBUG(@"Root span with id %@ has children but isn't waiting for them right now.",
self.rootSpan.context.spanId.sentrySpanIdString);
return;
}

Expand Down
14 changes: 10 additions & 4 deletions Sources/Sentry/SentryUIEventTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ - (void)start
[self.swizzleWrapper
swizzleSendAction:^(NSString *action, id target, id sender, UIEvent *event) {
if (target == nil) {
SENTRY_LOG_DEBUG(@"Target was nil for action %@; won't capture in transaction (sender: %@; event: %@)", action, sender, event);
SENTRY_LOG_DEBUG(@"Target was nil for action %@; won't capture in transaction "
@"(sender: %@; event: %@)",
action, sender, event);
return;
}

if (sender == nil) {
SENTRY_LOG_DEBUG(@"Sender was nil for action %@; won't capture in transaction (target: %@; event: %@)", action, sender, event);
SENTRY_LOG_DEBUG(@"Sender was nil for action %@; won't capture in transaction "
@"(target: %@; event: %@)",
action, sender, event);
return;
}

Expand Down Expand Up @@ -87,15 +91,17 @@ - (void)start
BOOL sameAction =
[currentActiveTransaction.transactionContext.name isEqualToString:transactionName];
if (sameAction) {
SENTRY_LOG_DEBUG(@"Dispatching idle timeout for transaction with span id %@", currentActiveTransaction.context.spanId.sentrySpanIdString);
SENTRY_LOG_DEBUG(@"Dispatching idle timeout for transaction with span id %@",
currentActiveTransaction.context.spanId.sentrySpanIdString);
[currentActiveTransaction dispatchIdleTimeout];
return;
}

[currentActiveTransaction finish];

if (currentActiveTransaction) {
SENTRY_LOG_DEBUG(@"SentryUIEventTracker finished transaction %@", currentActiveTransaction.transactionContext.name);
SENTRY_LOG_DEBUG(@"SentryUIEventTracker finished transaction %@",
currentActiveTransaction.transactionContext.name);
}

NSString *operation = [self getOperation:sender];
Expand Down
7 changes: 4 additions & 3 deletions Sources/Sentry/SentryUIViewControllerPerformanceTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ - (void)viewControllerLoadView:(UIViewController *)controller
target:controller
callbackToOrigin:callbackToOrigin
block:^{
SENTRY_LOG_DEBUG(@"Tracking UIViewController.loadView");
SENTRY_LOG_DEBUG(@"Tracking UIViewController.loadView");
[self createTransaction:controller];

[self measurePerformance:@"loadView"
Expand All @@ -74,7 +74,7 @@ - (void)viewControllerViewDidLoad:(UIViewController *)controller
target:controller
callbackToOrigin:callbackToOrigin
block:^{
SENTRY_LOG_DEBUG(@"Tracking UIViewController.viewDidLoad");
SENTRY_LOG_DEBUG(@"Tracking UIViewController.viewDidLoad");
[self createTransaction:controller];

[self measurePerformance:@"viewDidLoad"
Expand All @@ -95,7 +95,8 @@ - (void)createTransaction:(UIViewController *)controller
spanId = [self.tracker startSpanWithName:name
nameSource:kSentryTransactionNameSourceComponent
operation:SentrySpanOperationUILoad];
SENTRY_LOG_DEBUG(@"Started span with id %@ to track view controller.", spanId.sentrySpanIdString);
SENTRY_LOG_DEBUG(
@"Started span with id %@ to track view controller.", spanId.sentrySpanIdString);

// Use the target itself to store the spanId to avoid using a global mapper.
objc_setAssociatedObject(controller, &SENTRY_UI_PERFORMANCE_TRACKER_SPAN_ID, spanId,
Expand Down

0 comments on commit 411f5ab

Please sign in to comment.