-
-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hubs/Scopes Merge 23 - Use new API for CRONS integrations #3347
Changes from all commits
305baf5
95f5e1b
27f2398
ce3c14f
ce615f4
22ddc00
305c217
da927bc
8279276
9bfc086
b998e50
739827a
69f2d63
792d482
9bcbce6
3f25a4b
d6fb40a
7752bcc
1e329c5
b0d89ae
cdd414a
98da9ff
2d26033
bbb6700
c714b21
a474402
ae93e33
b01298b
1c5eab3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
import io.sentry.CheckInStatus; | ||
import io.sentry.DateUtils; | ||
import io.sentry.IScopes; | ||
import io.sentry.ISentryLifecycleToken; | ||
import io.sentry.ScopesAdapter; | ||
import io.sentry.SentryLevel; | ||
import io.sentry.protocol.SentryId; | ||
|
@@ -86,7 +87,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl | |
return invocation.proceed(); | ||
} | ||
|
||
scopes.pushScope(); | ||
final @NotNull ISentryLifecycleToken lifecycleToken = scopes.pushIsolationScope(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not 100% sure here, maybe we should make it configurable whether this isolates or not ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default should probably be isolated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah makes sense! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, static API and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The more I think about API, the more I think we should just find a sane default and only deliver that as a starting point. We can always add more API if users actually ask for it. |
||
TracingUtils.startNewTrace(scopes); | ||
|
||
@Nullable SentryId checkInId = null; | ||
|
@@ -106,7 +107,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl | |
CheckIn checkIn = new CheckIn(checkInId, monitorSlug, status); | ||
checkIn.setDuration(DateUtils.millisToSeconds(System.currentTimeMillis() - startTime)); | ||
scopes.captureCheckIn(checkIn); | ||
scopes.popScope(); | ||
lifecycleToken.close(); | ||
lbloder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import io.sentry.CheckInStatus; | ||
import io.sentry.DateUtils; | ||
import io.sentry.IScopes; | ||
import io.sentry.ISentryLifecycleToken; | ||
import io.sentry.MonitorConfig; | ||
import io.sentry.Sentry; | ||
import io.sentry.protocol.SentryId; | ||
|
@@ -30,12 +31,11 @@ public static <U> U withCheckIn( | |
final @Nullable MonitorConfig monitorConfig, | ||
final @NotNull Callable<U> callable) | ||
throws Exception { | ||
final @NotNull ISentryLifecycleToken lifecycleToken = Sentry.pushIsolationScope(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this should also be configurable to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default should probably also be isolated. Add overload with |
||
final @NotNull IScopes scopes = Sentry.getCurrentScopes(); | ||
final long startTime = System.currentTimeMillis(); | ||
boolean didError = false; | ||
|
||
// TODO fork instead | ||
scopes.pushScope(); | ||
TracingUtils.startNewTrace(scopes); | ||
|
||
CheckIn inProgressCheckIn = new CheckIn(monitorSlug, CheckInStatus.IN_PROGRESS); | ||
lbloder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -53,7 +53,7 @@ public static <U> U withCheckIn( | |
CheckIn checkIn = new CheckIn(checkInId, monitorSlug, status); | ||
checkIn.setDuration(DateUtils.millisToSeconds(System.currentTimeMillis() - startTime)); | ||
scopes.captureCheckIn(checkIn); | ||
scopes.popScope(); | ||
lifecycleToken.close(); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this it likely makes sense to have it isolated.