Skip to content

Commit

Permalink
Hubs/Scopes Merge 27 - Discussions (#3352)
Browse files Browse the repository at this point in the history
* replace hub with scopes

* Add Scopes

* Introduce `IScopes` interface.

* Replace `IHub` with `IScopes` in core

* Replace `IHub` with `IScopes` in android core

* Replace `IHub` with `IScopes` in android integrations

* Replace `IHub` with `IScopes` in apollo integrations

* Replace `IHub` with `IScopes` in okhttp integration

* Replace `IHub` with `IScopes` in graphql integration

* Replace `IHub` with `IScopes` in logging integrations

* Replace `IHub` with `IScopes` in more integrations

* Replace `IHub` with `IScopes` in OTel integration

* Replace `IHub` with `IScopes` in Spring 5 / Spring Boot 2 integrations

* Replace `IHub` with `IScopes` in Spring 6 / Spring Boot 3 integrations

* Replace `IHub` with `IScopes` in samples

* gitscopes -> github

* Replace ThreadLocal with ScopesStorage

* Move client and throwable to span map to scope

* Add global scope

* use global scope in Scopes

* Implement pushScope popScope and withScope for Scopes

* Add pushIsolationScope; add fork methods to ISCope

* Use separate scopes for current, isolation and global scope; rename mainScopes to rootScopes

* Allow controlling which scope configureScope uses

* Combine scopes

* Use new API for CRONS integrations

* Add lifecycle helper

* Change spring integrations to use new API

* Use new API in servlet integrations

* Use new API for kotlin coroutines and wrapers for Supplier/Callable

* Discussion TODOs
  • Loading branch information
adinauer authored Apr 22, 2024
1 parent e0cb935 commit a3ba20a
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ allprojects {
dependsOn("cleanTest")
}
withType<JavaCompile> {
options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror", "-Xlint:-classfile", "-Xlint:-processing"))
options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror", "-Xlint:-classfile", "-Xlint:-processing", "-Xlint:-try"))
}
}
}
Expand Down
179 changes: 165 additions & 14 deletions sentry/api/sentry.api

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions sentry/src/main/java/io/sentry/Breadcrumb.java
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ public void setUnknown(@Nullable Map<String, Object> unknown) {
@Override
@SuppressWarnings("JavaUtilDate")
public int compareTo(@NotNull Breadcrumb o) {
// TODO also use nano time if equal
return timestamp.compareTo(o.timestamp);
}

Expand Down
4 changes: 4 additions & 0 deletions sentry/src/main/java/io/sentry/CombinedScopeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ public void setTag(@NotNull String key, @NotNull String value) {

@Override
public void removeTag(@NotNull String key) {
// TODO should this go to all scopes?
getDefaultWriteScope().removeTag(key);
}

Expand All @@ -256,6 +257,7 @@ public void setExtra(@NotNull String key, @NotNull String value) {

@Override
public void removeExtra(@NotNull String key) {
// TODO should this go to all scopes?
getDefaultWriteScope().removeExtra(key);
}

Expand Down Expand Up @@ -305,10 +307,12 @@ public void setContexts(@NotNull String key, @NotNull Character value) {

@Override
public void removeContexts(@NotNull String key) {
// TODO should this go to all scopes?
getDefaultWriteScope().removeContexts(key);
}

private @NotNull IScope getDefaultWriteScope() {
// TODO use Scopes.getSpecificScope?
if (ScopeType.CURRENT.equals(getOptions().getDefaultScopeType())) {
return scope;
}
Expand Down
5 changes: 4 additions & 1 deletion sentry/src/main/java/io/sentry/ScopeType.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
public enum ScopeType {
CURRENT,
ISOLATION,
GLOBAL;
GLOBAL,

// TODO do we need a combined as well so configureScope
COMBINED;
}
2 changes: 2 additions & 0 deletions sentry/src/main/java/io/sentry/Scopes.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ public void endSession() {
}

private IScope getCombinedScopeView() {
// TODO create in ctor?
return new CombinedScopeView(getGlobalScope(), isolationScope, scope);
}

Expand Down Expand Up @@ -428,6 +429,7 @@ public void addBreadcrumb(final @NotNull Breadcrumb breadcrumb, final @Nullable
}

private IScope getSpecificScope(final @Nullable ScopeType scopeType) {
// TODO extract and reuse
if (scopeType != null) {
switch (scopeType) {
case CURRENT:
Expand Down

0 comments on commit a3ba20a

Please sign in to comment.