Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
305baf5
replace hub with scopes
adinauer Mar 27, 2024
95f5e1b
Add Scopes
adinauer Apr 2, 2024
27f2398
Introduce `IScopes` interface.
adinauer Apr 2, 2024
ce3c14f
Replace `IHub` with `IScopes` in core
adinauer Apr 2, 2024
ce615f4
Replace `IHub` with `IScopes` in android core
adinauer Apr 2, 2024
22ddc00
Replace `IHub` with `IScopes` in android integrations
adinauer Apr 2, 2024
305c217
Replace `IHub` with `IScopes` in apollo integrations
adinauer Apr 2, 2024
da927bc
Replace `IHub` with `IScopes` in okhttp integration
adinauer Apr 2, 2024
8279276
Replace `IHub` with `IScopes` in graphql integration
adinauer Apr 2, 2024
9bfc086
Replace `IHub` with `IScopes` in logging integrations
adinauer Apr 2, 2024
b998e50
Replace `IHub` with `IScopes` in more integrations
adinauer Apr 2, 2024
739827a
Replace `IHub` with `IScopes` in OTel integration
adinauer Apr 2, 2024
69f2d63
Replace `IHub` with `IScopes` in Spring 5 / Spring Boot 2 integrations
adinauer Apr 2, 2024
792d482
Replace `IHub` with `IScopes` in Spring 6 / Spring Boot 3 integrations
adinauer Apr 2, 2024
9bcbce6
Replace `IHub` with `IScopes` in samples
adinauer Apr 2, 2024
3f25a4b
Merge branch 'feat/hsm-13-replacements-in-samples' into feat/hubs-sco…
adinauer Apr 2, 2024
d6fb40a
gitscopes -> github
adinauer Apr 2, 2024
7752bcc
Replace ThreadLocal with ScopesStorage
adinauer Apr 4, 2024
1e329c5
Move client and throwable to span map to scope
adinauer Apr 4, 2024
b0d89ae
Add global scope
adinauer Apr 4, 2024
cdd414a
use global scope in Scopes
adinauer Apr 4, 2024
24d6d46
Merge branch '8.x.x' into feat/hsm-17-global-scope
adinauer Apr 19, 2024
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
1 change: 1 addition & 0 deletions sentry/api/sentry.api
Original file line number Diff line number Diff line change
Expand Up @@ -2004,6 +2004,7 @@ public final class io/sentry/Sentry {
public static fun getBaggage ()Lio/sentry/BaggageHeader;
public static fun getCurrentHub ()Lio/sentry/IHub;
public static fun getCurrentScopes ()Lio/sentry/IScopes;
public static fun getGlobalScope ()Lio/sentry/IScope;
public static fun getLastEventId ()Lio/sentry/protocol/SentryId;
public static fun getSpan ()Lio/sentry/ISpan;
public static fun getTraceparent ()Lio/sentry/SentryTraceHeader;
Expand Down
5 changes: 3 additions & 2 deletions sentry/src/main/java/io/sentry/Scopes.java
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,9 @@ private void updateLastEventId(final @NotNull SentryId lastEventId) {

// TODO add to IScopes interface
public @NotNull IScope getGlobalScope() {
// TODO return singleton global scope here
return scope;
// TODO should be:
return Sentry.getGlobalScope();
// return scope;
}

@Override
Expand Down
7 changes: 7 additions & 0 deletions sentry/src/main/java/io/sentry/Sentry.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ private Sentry() {}

/** The Main Hub or NoOp if Sentry is disabled. */
private static volatile @NotNull IScopes mainScopes = NoOpScopes.getInstance();
// TODO cannot pass options here
private static volatile @NotNull IScope globalScope = new Scope(new SentryOptions());
Copy link
Member Author

Choose a reason for hiding this comment

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

It should be possible for users to set data on global scope even before Sentry.init. Not quite sure where we should go with implementation. Likely we'll need a Scope constructor that doesn't require options and set options later on. Not quite sure how that should affect limits (e.g. for breadcrumbs) etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Problem resolved in #3362


/** Default value for globalHubMode is false */
private static final boolean GLOBAL_HUB_DEFAULT_MODE = false;
Expand Down Expand Up @@ -122,6 +124,9 @@ public static void setCurrentHub(final @NotNull IHub hub) {
public static @NotNull ISentryLifecycleToken setCurrentScopes(final @NotNull IScopes scopes) {
return getScopesStorage().set(scopes);
}

public static @NotNull IScope getGlobalScope() {
return globalScope;
}

/**
Expand Down Expand Up @@ -264,6 +269,8 @@ private static synchronized void init(
// TODO should be:
// getGlobalScope().bindClient(new SentryClient(options));
rootScope.bindClient(new SentryClient(options));
// TODO shouldn't replace global scope
globalScope = rootScope;
mainScopes = new Scopes(rootScope, rootScope, options, "Sentry.init");

getScopesStorage().set(mainScopes);
Expand Down