Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## Unreleased
## 8.23.1-alpha.1

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
android.useAndroidX=true

# Release information
versionName=8.23.0
versionName=8.23.1-alpha.1

# Override the SDK name on native crashes on Android
sentryAndroidSdkName=sentry.native.android
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ public Object key() {

@Override
public IScopes getValue() {
return Sentry.getCurrentScopes();
if (Sentry.hasScopes()) {
return Sentry.getCurrentScopes();
} else {
return NoOpScopes.getInstance();
}
}

@Override
Expand Down
1 change: 1 addition & 0 deletions sentry/api/sentry.api
Original file line number Diff line number Diff line change
Expand Up @@ -2599,6 +2599,7 @@ public final class io/sentry/Sentry {
public static fun getLastEventId ()Lio/sentry/protocol/SentryId;
public static fun getSpan ()Lio/sentry/ISpan;
public static fun getTraceparent ()Lio/sentry/SentryTraceHeader;
public static fun hasScopes ()Z
public static fun init ()V
public static fun init (Lio/sentry/OptionsContainer;Lio/sentry/Sentry$OptionsConfiguration;)V
public static fun init (Lio/sentry/OptionsContainer;Lio/sentry/Sentry$OptionsConfiguration;Z)V
Expand Down
6 changes: 6 additions & 0 deletions sentry/src/main/java/io/sentry/Sentry.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ private Sentry() {}
return scopes;
}

@ApiStatus.Internal
public static boolean hasScopes() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative to exposing this could be to have an overload of Sentry.getCurrentScopes() that could e.g. have a bool parameter to specify whether to fork rootScopes or just return NoOpScopes if there's nothing there yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah I would prefer this option, however for the purpose of the release I'm fine to go with this for now

final @Nullable IScopes scopes = getScopesStorage().get();
return scopes != null && !scopes.isNoOp();
}

private static @NotNull IScopesStorage getScopesStorage() {
return scopesStorage;
}
Expand Down
Loading