Skip to content

Commit 8fd337b

Browse files
romtsngetsentry-botmarkushilbloderstefanosiano
authored
7.0.0 (#2958)
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io> Co-authored-by: Roman Zavarnitsyn <rom4ek93@gmail.com> Co-authored-by: Markus Hintersteiner <markus.hintersteiner@sentry.io> Co-authored-by: Lukas Bloder <lukas.bloder@gmail.com> Co-authored-by: Stefano <stefano.siano@sentry.io> Co-authored-by: getsentry-bot <bot@sentry.io> Co-authored-by: getsentry-bot <bot@getsentry.com> Co-authored-by: Alexander Dinauer <adinauer@users.noreply.github.com> Co-authored-by: Richard Harrah <1672786+ToppleTheNun@users.noreply.github.com>
1 parent e6ffd7b commit 8fd337b

File tree

203 files changed

+5560
-2089
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+5560
-2089
lines changed

.craft.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ targets:
4949
maven:io.sentry:sentry-jdbc:
5050
maven:io.sentry:sentry-graphql:
5151
maven:io.sentry:sentry-quartz:
52+
# maven:io.sentry:sentry-okhttp:
5253
maven:io.sentry:sentry-android-navigation:
5354
maven:io.sentry:sentry-compose:
5455
maven:io.sentry:sentry-compose-android:

.github/ISSUE_TEMPLATE/bug_report_java.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ body:
3030
- sentry-quartz
3131
- sentry-openfeign
3232
- sentry-apache-http-client-5
33+
- sentry-okhttp
3334
- other
3435
validations:
3536
required: true

CHANGELOG.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,99 @@
22

33
## Unreleased
44

5+
Version 7 of the Sentry Android/Java SDK brings a variety of features and fixes. The most notable changes are:
6+
- Bumping `minSdk` level to 19 (Android 4.4)
7+
- The SDK will now listen to connectivity changes and try to re-upload cached events when internet connection is re-established additionally to uploading events on app restart
8+
- `Sentry.getSpan` now returns the root transaction, which should improve the span hierarchy and make it leaner
9+
- Multiple improvements to reduce probability of the SDK causing ANRs
10+
- New `sentry-okhttp` artifact is unbundled from Android and can be used in pure JVM-only apps
11+
12+
## Sentry Self-hosted Compatibility
13+
14+
This SDK version is compatible with a self-hosted version of Sentry `22.12.0` or higher. If you are using an older version of [self-hosted Sentry](https://develop.sentry.dev/self-hosted/) (aka onpremise), you will need to [upgrade](https://develop.sentry.dev/self-hosted/releases/). If you're using `sentry.io` no action is required.
15+
16+
## Sentry Integrations Version Compatibility (Android)
17+
18+
Make sure to align _all_ Sentry dependencies to the same version when bumping the SDK to 7.+, otherwise it will crash at runtime due to binary incompatibility. (E.g. if you're using `-timber`, `-okhttp` or other packages)
19+
20+
For example, if you're using the [Sentry Android Gradle plugin](https://github.com/getsentry/sentry-android-gradle-plugin) with the `autoInstallation` [feature](https://docs.sentry.io/platforms/android/configuration/gradle/#auto-installation) (enabled by default), make sure to use version 4.+ of the gradle plugin together with version 7.+ of the SDK. If you can't do that for some reason, you can specify sentry version via the plugin config block:
21+
22+
```kotlin
23+
sentry {
24+
autoInstallation {
25+
sentryVersion.set("7.0.0")
26+
}
27+
}
28+
```
29+
30+
Similarly, if you have a Sentry SDK (e.g. `sentry-android-core`) dependency on one of your Gradle modules and you're updating it to 7.+, make sure the Gradle plugin is at 4.+ or specify the SDK version as shown in the snippet above.
31+
32+
## Breaking Changes
33+
34+
- Bump min API to 19 ([#2883](https://github.com/getsentry/sentry-java/pull/2883))
35+
- If you're using `sentry-kotlin-extensions`, it requires `kotlinx-coroutines-core` version `1.6.1` or higher now ([#2838](https://github.com/getsentry/sentry-java/pull/2838))
36+
- Move enableNdk from SentryOptions to SentryAndroidOptions ([#2793](https://github.com/getsentry/sentry-java/pull/2793))
37+
- Apollo v2 BeforeSpanCallback now allows returning null ([#2890](https://github.com/getsentry/sentry-java/pull/2890))
38+
- `SentryOkHttpUtils` was removed from public API as it's been exposed by mistake ([#3005](https://github.com/getsentry/sentry-java/pull/3005))
39+
- `Scope` now implements the `IScope` interface, therefore some methods like `ScopeCallback.run` accept `IScope` now ([#3066](https://github.com/getsentry/sentry-java/pull/3066))
40+
- Cleanup `startTransaction` overloads ([#2964](https://github.com/getsentry/sentry-java/pull/2964))
41+
- We have reduced the number of overloads by allowing to pass in a `TransactionOptions` object instead of having separate parameters for certain options
42+
- `TransactionOptions` has defaults set and can be customized, for example:
43+
44+
```kotlin
45+
// old
46+
val transaction = Sentry.startTransaction("name", "op", bindToScope = true)
47+
// new
48+
val transaction = Sentry.startTransaction("name", "op", TransactionOptions().apply { isBindToScope = true })
49+
```
50+
51+
## Behavioural Changes
52+
53+
- Android only: `Sentry.getSpan()` returns the root span/transaction instead of the latest span ([#2855](https://github.com/getsentry/sentry-java/pull/2855))
54+
- Capture failed HTTP and GraphQL (Apollo) requests by default ([#2794](https://github.com/getsentry/sentry-java/pull/2794))
55+
- This can increase your event consumption and may affect your quota, because we will report failed network requests as Sentry events by default, if you're using the `sentry-android-okhttp` or `sentry-apollo-3` integrations. You can customize what errors you want/don't want to have reported for [OkHttp](https://docs.sentry.io/platforms/android/integrations/okhttp#http-client-errors) and [Apollo3](https://docs.sentry.io/platforms/android/integrations/apollo3#graphql-client-errors) respectively.
56+
- Measure AppStart time till First Draw instead of `onResume` ([#2851](https://github.com/getsentry/sentry-java/pull/2851))
57+
- Automatic user interaction tracking: every click now starts a new automatic transaction ([#2891](https://github.com/getsentry/sentry-java/pull/2891))
58+
- Previously performing a click on the same UI widget twice would keep the existing transaction running, the new behavior now better aligns with other SDKs
59+
- Add deadline timeout for automatic transactions ([#2865](https://github.com/getsentry/sentry-java/pull/2865))
60+
- This affects all automatically generated transactions on Android (UI, clicks), the default timeout is 30s, meaning the automatic transaction will be force-finished with status `deadline_exceeded` when reaching the deadline
61+
- Set ip_address to {{auto}} by default, even if sendDefaultPII is disabled ([#2860](https://github.com/getsentry/sentry-java/pull/2860))
62+
- Instead use the "Prevent Storing of IP Addresses" option in the "Security & Privacy" project settings on sentry.io
63+
- Raw logback message and parameters are now guarded by `sendDefaultPii` if an `encoder` has been configured ([#2976](https://github.com/getsentry/sentry-java/pull/2976))
64+
- The `maxSpans` setting (defaults to 1000) is enforced for nested child spans which means a single transaction can have `maxSpans` number of children (nested or not) at most ([#3065](https://github.com/getsentry/sentry-java/pull/3065))
65+
- The `ScopeCallback` in `withScope` is now always executed ([#3066](https://github.com/getsentry/sentry-java/pull/3066))
66+
67+
## Deprecations
68+
69+
- `sentry-android-okhttp` was deprecated in favour of the new `sentry-okhttp` module. Make sure to replace `io.sentry.android.okhttp` package name with `io.sentry.okhttp` before the next major, where the classes will be removed ([#3005](https://github.com/getsentry/sentry-java/pull/3005))
70+
71+
## Other Changes
72+
73+
### Features
74+
75+
- Observe network state to upload any unsent envelopes ([#2910](https://github.com/getsentry/sentry-java/pull/2910))
76+
- Android: it works out-of-the-box as part of the default `SendCachedEnvelopeIntegration`
77+
- JVM: you'd have to install `SendCachedEnvelopeFireAndForgetIntegration` as mentioned in https://docs.sentry.io/platforms/java/configuration/#configuring-offline-caching and provide your own implementation of `IConnectionStatusProvider` via `SentryOptions`
78+
- Add `sentry-okhttp` module to support instrumenting OkHttp in non-Android projects ([#3005](https://github.com/getsentry/sentry-java/pull/3005))
79+
- Do not filter out Sentry SDK frames in case of uncaught exceptions ([#3021](https://github.com/getsentry/sentry-java/pull/3021))
80+
- Do not try to send and drop cached envelopes when rate-limiting is active ([#2937](https://github.com/getsentry/sentry-java/pull/2937))
81+
582
### Fixes
683

84+
- Use `getMyMemoryState()` instead of `getRunningAppProcesses()` to retrieve process importance ([#3004](https://github.com/getsentry/sentry-java/pull/3004))
85+
- This should prevent some app stores from flagging apps as violating their privacy
86+
- Reduce flush timeout to 4s on Android to avoid ANRs ([#2858](https://github.com/getsentry/sentry-java/pull/2858))
87+
- Reduce timeout of AsyncHttpTransport to avoid ANR ([#2879](https://github.com/getsentry/sentry-java/pull/2879))
88+
- Do not overwrite UI transaction status if set by the user ([#2852](https://github.com/getsentry/sentry-java/pull/2852))
89+
- Capture unfinished transaction on Scope with status `aborted` in case a crash happens ([#2938](https://github.com/getsentry/sentry-java/pull/2938))
90+
- This will fix the link between transactions and corresponding crashes, you'll be able to see them in a single trace
91+
- Fix Coroutine Context Propagation using CopyableThreadContextElement ([#2838](https://github.com/getsentry/sentry-java/pull/2838))
92+
- Fix don't overwrite the span status of unfinished spans ([#2859](https://github.com/getsentry/sentry-java/pull/2859))
93+
- Migrate from `default` interface methods to proper implementations in each interface implementor ([#2847](https://github.com/getsentry/sentry-java/pull/2847))
94+
- This prevents issues when using the SDK on older AGP versions (< 4.x.x)
795
- Reduce main thread work on init ([#3036](https://github.com/getsentry/sentry-java/pull/3036))
896
- Move Integrations registration to background on init ([#3043](https://github.com/getsentry/sentry-java/pull/3043))
97+
- Fix `SentryOkHttpInterceptor.BeforeSpanCallback` was not finishing span when it was dropped ([#2958](https://github.com/getsentry/sentry-java/pull/2958))
998

1099
## 6.34.0
11100

buildSrc/src/main/java/Config.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ object Config {
3232
object Android {
3333
private val sdkVersion = 34
3434

35-
val minSdkVersion = 14
35+
val minSdkVersion = 19
3636
val minSdkVersionOkHttp = 21
37-
val minSdkVersionNdk = 16
37+
val minSdkVersionNdk = 19
3838
val minSdkVersionCompose = 21
3939
val targetSdkVersion = sdkVersion
4040
val compileSdkVersion = sdkVersion
@@ -111,7 +111,7 @@ object Config {
111111
val retrofit2 = "$retrofit2Group:retrofit:$retrofit2Version"
112112
val retrofit2Gson = "$retrofit2Group:converter-gson:$retrofit2Version"
113113

114-
val coroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3"
114+
val coroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1"
115115

116116
val fragment = "androidx.fragment:fragment-ktx:1.3.5"
117117

@@ -236,6 +236,7 @@ object Config {
236236
val SENTRY_SERVLET_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.servlet"
237237
val SENTRY_SERVLET_JAKARTA_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.servlet.jakarta"
238238
val SENTRY_COMPOSE_HELPER_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.compose.helper"
239+
val SENTRY_OKHTTP_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.okhttp"
239240
val group = "io.sentry"
240241
val description = "SDK for sentry.io"
241242
val versionNameProp = "versionName"

sentry-android-core/api/sentry-android-core.api

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public final class io/sentry/android/core/AnrIntegrationFactory {
8585
public final class io/sentry/android/core/AnrV2EventProcessor : io/sentry/BackfillingEventProcessor {
8686
public fun <init> (Landroid/content/Context;Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/android/core/BuildInfoProvider;)V
8787
public fun process (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/SentryEvent;
88+
public fun process (Lio/sentry/protocol/SentryTransaction;Lio/sentry/Hint;)Lio/sentry/protocol/SentryTransaction;
8889
}
8990

9091
public class io/sentry/android/core/AnrV2Integration : io/sentry/Integration, java/io/Closeable {
@@ -95,7 +96,10 @@ public class io/sentry/android/core/AnrV2Integration : io/sentry/Integration, ja
9596

9697
public final class io/sentry/android/core/AnrV2Integration$AnrV2Hint : io/sentry/hints/BlockingFlushHint, io/sentry/hints/AbnormalExit, io/sentry/hints/Backfillable {
9798
public fun <init> (JLio/sentry/ILogger;JZZ)V
99+
public fun ignoreCurrentThread ()Z
100+
public fun isFlushable (Lio/sentry/protocol/SentryId;)Z
98101
public fun mechanism ()Ljava/lang/String;
102+
public fun setFlushable (Lio/sentry/protocol/SentryId;)V
99103
public fun shouldEnrich ()Z
100104
public fun timestamp ()Ljava/lang/Long;
101105
}
@@ -197,8 +201,8 @@ public abstract interface class io/sentry/android/core/IDebugImagesLoader {
197201
public final class io/sentry/android/core/InternalSentrySdk {
198202
public fun <init> ()V
199203
public static fun captureEnvelope ([B)Lio/sentry/protocol/SentryId;
200-
public static fun getCurrentScope ()Lio/sentry/Scope;
201-
public static fun serializeScope (Landroid/content/Context;Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/Scope;)Ljava/util/Map;
204+
public static fun getCurrentScope ()Lio/sentry/IScope;
205+
public static fun serializeScope (Landroid/content/Context;Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/IScope;)Ljava/util/Map;
202206
}
203207

204208
public final class io/sentry/android/core/LoadClass {
@@ -227,9 +231,10 @@ public final class io/sentry/android/core/PhoneStateBreadcrumbsIntegration : io/
227231
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
228232
}
229233

230-
public final class io/sentry/android/core/ScreenshotEventProcessor : io/sentry/EventProcessor, io/sentry/IntegrationName {
234+
public final class io/sentry/android/core/ScreenshotEventProcessor : io/sentry/EventProcessor {
231235
public fun <init> (Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/android/core/BuildInfoProvider;)V
232236
public fun process (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/SentryEvent;
237+
public fun process (Lio/sentry/protocol/SentryTransaction;Lio/sentry/Hint;)Lio/sentry/protocol/SentryTransaction;
233238
}
234239

235240
public final class io/sentry/android/core/SentryAndroid {
@@ -267,8 +272,10 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr
267272
public fun isEnableAppLifecycleBreadcrumbs ()Z
268273
public fun isEnableAutoActivityLifecycleTracing ()Z
269274
public fun isEnableFramesTracking ()Z
275+
public fun isEnableNdk ()Z
270276
public fun isEnableNetworkEventBreadcrumbs ()Z
271277
public fun isEnableRootCheck ()Z
278+
public fun isEnableScopeSync ()Z
272279
public fun isEnableSystemEventBreadcrumbs ()Z
273280
public fun isReportHistoricalAnrs ()Z
274281
public fun setAnrEnabled (Z)V
@@ -287,8 +294,10 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr
287294
public fun setEnableAppLifecycleBreadcrumbs (Z)V
288295
public fun setEnableAutoActivityLifecycleTracing (Z)V
289296
public fun setEnableFramesTracking (Z)V
297+
public fun setEnableNdk (Z)V
290298
public fun setEnableNetworkEventBreadcrumbs (Z)V
291299
public fun setEnableRootCheck (Z)V
300+
public fun setEnableScopeSync (Z)V
292301
public fun setEnableSystemEventBreadcrumbs (Z)V
293302
public fun setNativeSdkName (Ljava/lang/String;)V
294303
public fun setProfilingTracesHz (I)V
@@ -368,9 +377,10 @@ public final class io/sentry/android/core/UserInteractionIntegration : android/a
368377
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
369378
}
370379

371-
public final class io/sentry/android/core/ViewHierarchyEventProcessor : io/sentry/EventProcessor, io/sentry/IntegrationName {
380+
public final class io/sentry/android/core/ViewHierarchyEventProcessor : io/sentry/EventProcessor {
372381
public fun <init> (Lio/sentry/android/core/SentryAndroidOptions;)V
373382
public fun process (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/SentryEvent;
383+
public fun process (Lio/sentry/protocol/SentryTransaction;Lio/sentry/Hint;)Lio/sentry/protocol/SentryTransaction;
374384
public static fun snapshotViewHierarchy (Landroid/app/Activity;Lio/sentry/ILogger;)Lio/sentry/protocol/ViewHierarchy;
375385
public static fun snapshotViewHierarchy (Landroid/app/Activity;Ljava/util/List;Lio/sentry/util/thread/IMainThreadChecker;Lio/sentry/ILogger;)Lio/sentry/protocol/ViewHierarchy;
376386
public static fun snapshotViewHierarchy (Landroid/view/View;)Lio/sentry/protocol/ViewHierarchy;

sentry-android-core/proguard-rules.pro

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,22 @@
3131
-keepattributes LineNumberTable,SourceFile
3232

3333
# Keep Classnames for integrations
34-
-keepnames class * implements io.sentry.IntegrationName
34+
-keepnames class * implements io.sentry.Integration
35+
36+
-dontwarn io.sentry.apollo.SentryApolloInterceptor
37+
-keepnames class io.sentry.apollo.SentryApolloInterceptor
38+
39+
-dontwarn io.sentry.apollo3.SentryApollo3HttpInterceptor
40+
-keepnames class io.sentry.apollo3.SentryApollo3HttpInterceptor
41+
42+
-dontwarn io.sentry.android.okhttp.SentryOkHttpInterceptor
43+
-keepnames class io.sentry.android.okhttp.SentryOkHttpInterceptor
44+
45+
-dontwarn io.sentry.android.navigation.SentryNavigationListener
46+
-keepnames class io.sentry.android.navigation.SentryNavigationListener
47+
48+
-keepnames class io.sentry.android.core.ScreenshotEventProcessor
49+
-keepnames class io.sentry.android.core.ViewHierarchyEventProcessor
3550

3651
# Keep any custom option classes like SentryAndroidOptions, as they're loaded via reflection
3752
# Also keep method names, as they're e.g. used by native via JNI calls

0 commit comments

Comments
 (0)