Skip to content

Commit ea117ff

Browse files
adinauermarkushi
andauthored
Add changelog for 8.x (alpha) release (#3421)
* changelog and more deprecation javadoc * Update CHANGELOG.md Co-authored-by: Markus Hintersteiner <[email protected]> --------- Co-authored-by: Markus Hintersteiner <[email protected]>
1 parent 6c31cc0 commit ea117ff

File tree

12 files changed

+121
-0
lines changed

12 files changed

+121
-0
lines changed

CHANGELOG.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,55 @@
22

33
## Unreleased
44

5+
Version 8 of the Sentry Android/Java SDK brings a variety of features and fixes. The most notable changes are:
6+
7+
- New `Scope` types have been introduced, see "Behavioural Changes" for more details.
8+
- Lifecycle tokens have been introduced to manage `Scope` lifecycle, see "Behavioural Changes" for more details.
9+
- `Hub` has been replaced by `Scopes`
10+
11+
### Behavioural Changes
12+
13+
- We're introducing some new `Scope` types in the SDK, allowing for better control over what data is attached where. Previously there was a stack of scopes that was pushed and popped. Instead we now fork scopes for a given lifecycle and then restore the previous scopes. Since `Hub` is gone, it is also never cloned anymore. Separation of data now happens through the different scope types while making it easier to manipulate exactly what you need without having to attach data at the right time to have it apply where wanted.
14+
- Global scope is attached to all events created by the SDK. It can also be modified before `Sentry.init` has been called. It can be manipulated using `Sentry.configureScope(ScopeType.GLOBAL, (scope) -> { ... })`.
15+
- Isolation scope can be used e.g. to attach data to all events that come up while handling an incoming request. It can also be used for other isolation purposes. It can be manipulated using `Sentry.configureScope(ScopeType.ISOLATION, (scope) -> { ... })`. The SDK automatically forks isolation scope in certain cases like incoming requests, CRON jobs, Spring `@Async` and more.
16+
- Current scope is forked often and data added to it is only added to events that are created while this scope is active. Data is also passed on to newly forked child scopes but not to parents.
17+
- `Sentry.popScope` has been deprecated, please call `.close()` on the token returned by `Sentry.pushScope` instead or use it in a way described in more detail in "Migration Guide".
18+
- We have chosen a default scope that is used for `Sentry.configureScope()` as well as API like `Sentry.setTag()`
19+
- For Android the type defaults to `CURRENT` scope
20+
- For Backend and other JVM applicatons it defaults to `ISOLATION` scope
21+
- Event processors on `Scope` can now be ordered by overriding the `getOrder` method on implementations of `EventProcessor`. NOTE: This order only applies to event processors on `Scope` but not `SentryOptions` at the moment. Feel free to request this if you need it.
22+
- `Hub` is deprecated in favor of `Scopes`, alongside some `Hub` relevant APIs. More details can be found in the "Migration Guide" section.
23+
24+
### Breaking Changes
25+
26+
- `Contexts` no longer extends `ConcurrentHashMap`, instead we offer a selected set of methods.
27+
28+
### Migration Guide / Deprecations
29+
30+
- `Hub` has been deprecated, we're replacing the following:
31+
- `IHub` has been replaced by `IScopes`, however you should be able to simply pass `IHub` instances to code expecting `IScopes`, allowing for an easier migration.
32+
- `HubAdapter.getInstance()` has been replaced by `ScopesAdapter.getInstance()`
33+
- The `.clone()` method on `IHub`/`IScopes` has been deprecated, please use `.pushScope()` or `.pushIsolationScope()` instead
34+
- Some internal methods like `.getCurrentHub()` and `.setCurrentHub()` have also been replaced.
35+
- `Sentry.popScope` has been replaced by calling `.close()` on the token returned by `Sentry.pushScope()` and `Sentry.pushIsolationScope()`. The token can also be used in a `try` block like this:
36+
37+
```
38+
try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushScope()) {
39+
// this block has its separate current scope
40+
}
41+
```
42+
43+
as well as:
44+
45+
46+
```
47+
try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushIsolationScope()) {
48+
// this block has its separate isolation scope
49+
}
50+
```
51+
52+
You may also use `LifecycleHelper.close(token)`, e.g. in case you need to pass the token around for closing later.
53+
554
### Features
655

756
- Report exceptions returned by Throwable.getSuppressed() to Sentry as exception groups ([#3396] https://github.com/getsentry/sentry-java/pull/3396)

sentry-graphql/src/main/java/io/sentry/graphql/ExceptionReporter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ public boolean isSubscription() {
149149
return isSubscription;
150150
}
151151

152+
/**
153+
* @deprecated please use {@link ExceptionDetails#getScopes()} instead.
154+
*/
152155
@Deprecated
153156
public @NotNull IScopes getHub() {
154157
return scopes;

sentry-graphql/src/main/java/io/sentry/graphql/SentryInstrumentation.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public final class SentryInstrumentation
4848
);
4949
public static final @NotNull String SENTRY_SCOPES_CONTEXT_KEY = "sentry.scopes";
5050

51+
/**
52+
* @deprecated please use {@link SentryInstrumentation#SENTRY_SCOPES_CONTEXT_KEY} instead.
53+
*/
5154
@Deprecated
5255
public static final @NotNull String SENTRY_HUB_CONTEXT_KEY = SENTRY_SCOPES_CONTEXT_KEY;
5356

sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@
3535
public abstract class AbstractSentryWebFilter implements WebFilter {
3636
private final @NotNull SentryRequestResolver sentryRequestResolver;
3737
public static final String SENTRY_SCOPES_KEY = "sentry-scopes";
38+
39+
/**
40+
* @deprecated please use {@link AbstractSentryWebFilter#SENTRY_SCOPES_KEY} instead.
41+
*/
3842
@Deprecated public static final String SENTRY_HUB_KEY = SENTRY_SCOPES_KEY;
43+
3944
private static final String TRANSACTION_OP = "http.server";
4045

4146
public AbstractSentryWebFilter(final @NotNull IScopes scopes) {

sentry-spring/src/main/java/io/sentry/spring/webflux/SentryWebFilter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@
3535
@ApiStatus.Experimental
3636
public final class SentryWebFilter implements WebFilter {
3737
public static final String SENTRY_SCOPES_KEY = "sentry-scopes";
38+
/**
39+
* @deprecated please use {@link SentryWebFilter#SENTRY_SCOPES_KEY} instead.
40+
*/
3841
@Deprecated public static final String SENTRY_HUB_KEY = SENTRY_SCOPES_KEY;
42+
3943
private static final String TRANSACTION_OP = "http.server";
4044
private static final String TRACE_ORIGIN = "auto.spring.webflux";
4145

sentry/src/main/java/io/sentry/HubAdapter.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ public void removeExtra(@NotNull String key) {
163163
return Sentry.pushIsolationScope();
164164
}
165165

166+
/**
167+
* @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link
168+
* ScopesAdapter#pushScope()} or {@link ScopesAdapter#pushIsolationScope()} instead.
169+
*/
166170
@Override
167171
@Deprecated
168172
public void popScope() {
@@ -199,6 +203,11 @@ public void flush(long timeoutMillis) {
199203
Sentry.flush(timeoutMillis);
200204
}
201205

206+
/**
207+
* @deprecated please use {@link IScopes#forkedScopes(String)} or {@link
208+
* IScopes#forkedCurrentScope(String)} instead.
209+
*/
210+
@Deprecated
202211
@Override
203212
public @NotNull IHub clone() {
204213
return Sentry.getCurrentScopes().clone();

sentry/src/main/java/io/sentry/HubScopesWrapper.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ public void removeExtra(@NotNull String key) {
158158
return scopes.pushIsolationScope();
159159
}
160160

161+
/**
162+
* @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link
163+
* IScopes#pushScope()} or {@link IScopes#pushIsolationScope()} instead.
164+
*/
161165
@Override
162166
@Deprecated
163167
public void popScope() {
@@ -194,7 +198,12 @@ public void flush(long timeoutMillis) {
194198
scopes.flush(timeoutMillis);
195199
}
196200

201+
/**
202+
* @deprecated please use {@link IScopes#forkedScopes(String)} or {@link
203+
* IScopes#forkedCurrentScope(String)} instead.
204+
*/
197205
@Override
206+
@Deprecated
198207
public @NotNull IHub clone() {
199208
return scopes.clone();
200209
}

sentry/src/main/java/io/sentry/NoOpHub.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ public void removeExtra(@NotNull String key) {}
136136
return NoOpScopesStorage.NoOpScopesLifecycleToken.getInstance();
137137
}
138138

139+
/**
140+
* @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link
141+
* IScopes#pushScope()} or {@link IScopes#pushIsolationScope()} instead.
142+
*/
139143
@Override
140144
@Deprecated
141145
public void popScope() {}
@@ -164,6 +168,11 @@ public boolean isHealthy() {
164168
@Override
165169
public void flush(long timeoutMillis) {}
166170

171+
/**
172+
* @deprecated please use {@link IScopes#forkedScopes(String)} or {@link
173+
* IScopes#forkedCurrentScope(String)} instead.
174+
*/
175+
@Deprecated
167176
@Override
168177
public @NotNull IHub clone() {
169178
return instance;

sentry/src/main/java/io/sentry/NoOpScopes.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ public void removeExtra(@NotNull String key) {}
131131
return NoOpScopesStorage.NoOpScopesLifecycleToken.getInstance();
132132
}
133133

134+
/**
135+
* @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link
136+
* IScopes#pushScope()} or {@link IScopes#pushIsolationScope()} instead.
137+
*/
134138
@Override
135139
@Deprecated
136140
public void popScope() {}
@@ -159,6 +163,10 @@ public boolean isHealthy() {
159163
@Override
160164
public void flush(long timeoutMillis) {}
161165

166+
/**
167+
* @deprecated please use {@link IScopes#forkedScopes(String)} or {@link
168+
* IScopes#forkedCurrentScope(String)} instead.
169+
*/
162170
@Deprecated
163171
@Override
164172
public @NotNull IHub clone() {

sentry/src/main/java/io/sentry/Scopes.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,10 @@ public ISentryLifecycleToken pushIsolationScope() {
607607
return Sentry.setCurrentScopes(this);
608608
}
609609

610+
/**
611+
* @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link
612+
* IScopes#pushScope()} or {@link IScopes#pushIsolationScope()} instead.
613+
*/
610614
@Override
611615
@Deprecated
612616
public void popScope() {
@@ -715,7 +719,12 @@ public void flush(long timeoutMillis) {
715719
}
716720
}
717721

722+
/**
723+
* @deprecated please use {@link IScopes#forkedScopes(String)} or {@link
724+
* IScopes#forkedCurrentScope(String)} instead.
725+
*/
718726
@Override
727+
@Deprecated
719728
@SuppressWarnings("deprecation")
720729
public @NotNull IHub clone() {
721730
if (!isEnabled()) {

0 commit comments

Comments
 (0)