Skip to content

Commit 9352f1c

Browse files
committed
Merge branch 'main' into feat/internal-sdk-debug-image-fetching-per-stacktrace
2 parents e948c38 + c2e65f0 commit 9352f1c

File tree

51 files changed

+769
-837
lines changed

Some content is hidden

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

51 files changed

+769
-837
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: make preMerge
3636

3737
- name: Upload coverage to Codecov
38-
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # pin@v4
38+
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # pin@v4
3939
with:
4040
name: sentry-java
4141
fail_ci_if_error: false

CHANGELOG.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,28 @@
22

33
## Unreleased
44

5+
### Fixes
6+
7+
- Do not log if `OtelContextScopesStorage` cannot be found ([#4127](https://github.com/getsentry/sentry-java/pull/4127))
8+
- Previously `java.lang.ClassNotFoundException: io.sentry.opentelemetry.OtelContextScopesStorage` was shown in the log if the class could not be found.
9+
- This is just a lookup the SDK performs to configure itself. The SDK also works without OpenTelemetry.
10+
11+
### Dependencies
12+
13+
- Bump Native SDK from v0.7.19 to v0.7.20 ([#4128](https://github.com/getsentry/sentry-java/pull/4128))
14+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0720)
15+
- [diff](https://github.com/getsentry/sentry-native/compare/v0.7.19...0.7.20)
16+
17+
## 8.1.0
18+
519
### Features
620

721
- Add `options.ignoredErrors` to filter out errors that match a certain String or Regex ([#4083](https://github.com/getsentry/sentry-java/pull/4083))
822
- The matching is attempted on `event.message`, `event.formatted`, and `{event.throwable.class.name}: {event.throwable.message}`
923
- Can be set in `sentry.properties`, e.g. `ignored-errors=Some error,Another .*`
1024
- Can be set in environment variables, e.g. `SENTRY_IGNORED_ERRORS=Some error,Another .*`
1125
- For Spring Boot, it can be set in `application.properties`, e.g. `sentry.ignored-errors=Some error,Another .*`
26+
- Log OpenTelemetry related Sentry config ([#4122](https://github.com/getsentry/sentry-java/pull/4122))
1227

1328
### Fixes
1429

@@ -18,6 +33,37 @@
1833
- Remove `java.lang.ClassNotFoundException` debug logs when searching for OpenTelemetry marker classes ([#4091](https://github.com/getsentry/sentry-java/pull/4091))
1934
- There was up to three of these, one for `io.sentry.opentelemetry.agent.AgentMarker`, `io.sentry.opentelemetry.agent.AgentlessMarker` and `io.sentry.opentelemetry.agent.AgentlessSpringMarker`.
2035
- These were not indicators of something being wrong but rather the SDK looking at what is available at runtime to configure itself accordingly.
36+
- Do not instrument File I/O operations if tracing is disabled ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
37+
- Do not instrument User Interaction multiple times ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
38+
- Speed up view traversal to find touched target in `UserInteractionIntegration` ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
39+
- Reduce IPC/Binder calls performed by the SDK ([#4058](https://github.com/getsentry/sentry-java/pull/4058))
40+
41+
### Behavioural Changes
42+
43+
- Reduce the number of broadcasts the SDK is subscribed for ([#4052](https://github.com/getsentry/sentry-java/pull/4052))
44+
- Drop `TempSensorBreadcrumbsIntegration`
45+
- Drop `PhoneStateBreadcrumbsIntegration`
46+
- Reduce number of broadcasts in `SystemEventsBreadcrumbsIntegration`
47+
48+
Current list of the broadcast events can be found [here](https://github.com/getsentry/sentry-java/blob/9b8dc0a844d10b55ddeddf55d278c0ab0f86421c/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java#L131-L153). If you'd like to subscribe for more events, consider overriding the `SystemEventsBreadcrumbsIntegration` as follows:
49+
50+
```kotlin
51+
SentryAndroid.init(context) { options ->
52+
options.integrations.removeAll { it is SystemEventsBreadcrumbsIntegration }
53+
options.integrations.add(SystemEventsBreadcrumbsIntegration(context, SystemEventsBreadcrumbsIntegration.getDefaultActions() + listOf(/* your custom actions */)))
54+
}
55+
```
56+
57+
If you would like to keep some of the default broadcast events as breadcrumbs, consider opening a [GitHub issue](https://github.com/getsentry/sentry-java/issues/new).
58+
- Set mechanism `type` to `suppressed` for suppressed exceptions ([#4125](https://github.com/getsentry/sentry-java/pull/4125))
59+
- This helps to distinguish an exceptions cause from any suppressed exceptions in the Sentry UI
60+
61+
### Dependencies
62+
63+
- Bump Spring Boot to `3.4.2` ([#4081](https://github.com/getsentry/sentry-java/pull/4081))
64+
- Bump Native SDK from v0.7.14 to v0.7.19 ([#4076](https://github.com/getsentry/sentry-java/pull/4076))
65+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0719)
66+
- [diff](https://github.com/getsentry/sentry-native/compare/v0.7.14...0.7.19)
2167

2268
## 8.0.0
2369

@@ -320,6 +366,68 @@ If you have been using `8.0.0-rc.4` of the Java SDK, here's the new changes that
320366
- We are planning to improve this in the future but opted for this fix first.
321367
- Fix swallow NDK loadLibrary errors ([#4082](https://github.com/getsentry/sentry-java/pull/4082))
322368

369+
## 7.21.0
370+
371+
### Fixes
372+
373+
- Do not instrument File I/O operations if tracing is disabled ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
374+
- Do not instrument User Interaction multiple times ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
375+
- Speed up view traversal to find touched target in `UserInteractionIntegration` ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
376+
- Reduce IPC/Binder calls performed by the SDK ([#4058](https://github.com/getsentry/sentry-java/pull/4058))
377+
378+
### Behavioural Changes
379+
380+
- Reduce the number of broadcasts the SDK is subscribed for ([#4052](https://github.com/getsentry/sentry-java/pull/4052))
381+
- Drop `TempSensorBreadcrumbsIntegration`
382+
- Drop `PhoneStateBreadcrumbsIntegration`
383+
- Reduce number of broadcasts in `SystemEventsBreadcrumbsIntegration`
384+
385+
Current list of the broadcast events can be found [here](https://github.com/getsentry/sentry-java/blob/9b8dc0a844d10b55ddeddf55d278c0ab0f86421c/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java#L131-L153). If you'd like to subscribe for more events, consider overriding the `SystemEventsBreadcrumbsIntegration` as follows:
386+
387+
```kotlin
388+
SentryAndroid.init(context) { options ->
389+
options.integrations.removeAll { it is SystemEventsBreadcrumbsIntegration }
390+
options.integrations.add(SystemEventsBreadcrumbsIntegration(context, SystemEventsBreadcrumbsIntegration.getDefaultActions() + listOf(/* your custom actions */)))
391+
}
392+
```
393+
394+
If you would like to keep some of the default broadcast events as breadcrumbs, consider opening a [GitHub issue](https://github.com/getsentry/sentry-java/issues/new).
395+
396+
## 7.21.0-beta.1
397+
398+
### Fixes
399+
400+
- Do not instrument File I/O operations if tracing is disabled ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
401+
- Do not instrument User Interaction multiple times ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
402+
- Speed up view traversal to find touched target in `UserInteractionIntegration` ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
403+
- Reduce IPC/Binder calls performed by the SDK ([#4058](https://github.com/getsentry/sentry-java/pull/4058))
404+
405+
### Behavioural Changes
406+
407+
- Reduce the number of broadcasts the SDK is subscribed for ([#4052](https://github.com/getsentry/sentry-java/pull/4052))
408+
- Drop `TempSensorBreadcrumbsIntegration`
409+
- Drop `PhoneStateBreadcrumbsIntegration`
410+
- Reduce number of broadcasts in `SystemEventsBreadcrumbsIntegration`
411+
412+
Current list of the broadcast events can be found [here](https://github.com/getsentry/sentry-java/blob/9b8dc0a844d10b55ddeddf55d278c0ab0f86421c/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java#L131-L153). If you'd like to subscribe for more events, consider overriding the `SystemEventsBreadcrumbsIntegration` as follows:
413+
414+
```kotlin
415+
SentryAndroid.init(context) { options ->
416+
options.integrations.removeAll { it is SystemEventsBreadcrumbsIntegration }
417+
options.integrations.add(SystemEventsBreadcrumbsIntegration(context, SystemEventsBreadcrumbsIntegration.getDefaultActions() + listOf(/* your custom actions */)))
418+
}
419+
```
420+
421+
If you would like to keep some of the default broadcast events as breadcrumbs, consider opening a [GitHub issue](https://github.com/getsentry/sentry-java/issues/new).
422+
423+
## 7.20.1
424+
425+
### Behavioural Changes
426+
427+
- The user ip-address is now only set to `"{{auto}}"` if sendDefaultPii is enabled ([#4071](https://github.com/getsentry/sentry-java/pull/4071))
428+
- This change gives you control over IP address collection directly on the client
429+
430+
323431
## 7.20.0
324432

325433
### Features

buildSrc/src/main/java/Config.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object Config {
77
val kotlinStdLib = "stdlib-jdk8"
88

99
val springBootVersion = "2.7.5"
10-
val springBoot3Version = "3.4.0"
10+
val springBoot3Version = "3.4.2"
1111
val kotlinCompatibleLanguageVersion = "1.4"
1212

1313
val composeVersion = "1.5.3"
@@ -153,7 +153,7 @@ object Config {
153153

154154
val apolloKotlin = "com.apollographql.apollo3:apollo-runtime:3.8.2"
155155

156-
val sentryNativeNdk = "io.sentry:sentry-native-ndk:0.7.14"
156+
val sentryNativeNdk = "io.sentry:sentry-native-ndk:0.7.20"
157157

158158
object OpenTelemetry {
159159
val otelVersion = "1.44.1"

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ android.useAndroidX=true
1313
android.defaults.buildfeatures.buildconfig=true
1414

1515
# Release information
16-
versionName=8.0.0
16+
versionName=8.1.0
1717

1818
# Override the SDK name on native crashes on Android
1919
sentryAndroidSdkName=sentry.native.android

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ public final class io/sentry/android/core/DeviceInfoUtil {
195195
public static fun getInstance (Landroid/content/Context;Lio/sentry/android/core/SentryAndroidOptions;)Lio/sentry/android/core/DeviceInfoUtil;
196196
public fun getOperatingSystem ()Lio/sentry/protocol/OperatingSystem;
197197
public fun getSideLoadedInfo ()Lio/sentry/android/core/ContextUtils$SideLoadedInfo;
198+
public fun getTotalMemory ()Ljava/lang/Long;
198199
public static fun isCharging (Landroid/content/Intent;Lio/sentry/SentryOptions;)Ljava/lang/Boolean;
199200
public static fun resetInstance ()V
200201
}
@@ -249,12 +250,6 @@ public final class io/sentry/android/core/NetworkBreadcrumbsIntegration : io/sen
249250
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
250251
}
251252

252-
public final class io/sentry/android/core/PhoneStateBreadcrumbsIntegration : io/sentry/Integration, java/io/Closeable {
253-
public fun <init> (Landroid/content/Context;)V
254-
public fun close ()V
255-
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
256-
}
257-
258253
public final class io/sentry/android/core/ScreenshotEventProcessor : io/sentry/EventProcessor {
259254
public fun <init> (Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/android/core/BuildInfoProvider;)V
260255
public fun getOrder ()Ljava/lang/Long;
@@ -383,14 +378,7 @@ public final class io/sentry/android/core/SystemEventsBreadcrumbsIntegration : i
383378
public fun <init> (Landroid/content/Context;)V
384379
public fun <init> (Landroid/content/Context;Ljava/util/List;)V
385380
public fun close ()V
386-
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
387-
}
388-
389-
public final class io/sentry/android/core/TempSensorBreadcrumbsIntegration : android/hardware/SensorEventListener, io/sentry/Integration, java/io/Closeable {
390-
public fun <init> (Landroid/content/Context;)V
391-
public fun close ()V
392-
public fun onAccuracyChanged (Landroid/hardware/Sensor;I)V
393-
public fun onSensorChanged (Landroid/hardware/SensorEvent;)V
381+
public static fun getDefaultActions ()Ljava/util/List;
394382
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
395383
}
396384

@@ -536,3 +524,14 @@ public class io/sentry/android/core/performance/WindowContentChangedCallback : i
536524
public fun onContentChanged ()V
537525
}
538526

527+
public final class io/sentry/android/core/util/AndroidLazyEvaluator {
528+
public fun <init> (Lio/sentry/android/core/util/AndroidLazyEvaluator$AndroidEvaluator;)V
529+
public fun getValue (Landroid/content/Context;)Ljava/lang/Object;
530+
public fun resetValue ()V
531+
public fun setValue (Ljava/lang/Object;)V
532+
}
533+
534+
public abstract interface class io/sentry/android/core/util/AndroidLazyEvaluator$AndroidEvaluator {
535+
public abstract fun evaluate (Landroid/content/Context;)Ljava/lang/Object;
536+
}
537+

sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,6 @@ static void installDefaultIntegrations(
305305
options.addIntegration(new SystemEventsBreadcrumbsIntegration(context));
306306
options.addIntegration(
307307
new NetworkBreadcrumbsIntegration(context, buildInfoProvider, options.getLogger()));
308-
options.addIntegration(new TempSensorBreadcrumbsIntegration(context));
309-
options.addIntegration(new PhoneStateBreadcrumbsIntegration(context));
310308
if (isReplayAvailable) {
311309
final ReplayIntegration replay =
312310
new ReplayIntegration(context, CurrentDateProvider.getInstance());
@@ -326,8 +324,8 @@ private static void readDefaultOptionValues(
326324
final @NotNull SentryAndroidOptions options,
327325
final @NotNull Context context,
328326
final @NotNull BuildInfoProvider buildInfoProvider) {
329-
final PackageInfo packageInfo =
330-
ContextUtils.getPackageInfo(context, options.getLogger(), buildInfoProvider);
327+
final @Nullable PackageInfo packageInfo =
328+
ContextUtils.getPackageInfo(context, buildInfoProvider);
331329
if (packageInfo != null) {
332330
// Sets App's release if not set by Manifest
333331
if (options.getRelease() == null) {

sentry-android-core/src/main/java/io/sentry/android/core/AndroidTransactionProfiler.java

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package io.sentry.android.core;
22

3-
import static android.content.Context.ACTIVITY_SERVICE;
43
import static java.util.concurrent.TimeUnit.SECONDS;
54

65
import android.annotation.SuppressLint;
7-
import android.app.ActivityManager;
86
import android.content.Context;
97
import android.os.Build;
108
import android.os.Process;
@@ -258,9 +256,12 @@ public void bindTransaction(final @NotNull ITransaction transaction) {
258256
transactionsCounter = 0;
259257

260258
String totalMem = "0";
261-
ActivityManager.MemoryInfo memInfo = getMemInfo();
262-
if (memInfo != null) {
263-
totalMem = Long.toString(memInfo.totalMem);
259+
final @Nullable Long memory =
260+
(options instanceof SentryAndroidOptions)
261+
? DeviceInfoUtil.getInstance(context, (SentryAndroidOptions) options).getTotalMemory()
262+
: null;
263+
if (memory != null) {
264+
totalMem = Long.toString(memory);
264265
}
265266
String[] abis = Build.SUPPORTED_ABIS;
266267

@@ -327,27 +328,6 @@ public void close() {
327328
}
328329
}
329330

330-
/**
331-
* Get MemoryInfo object representing the memory state of the application.
332-
*
333-
* @return MemoryInfo object representing the memory state of the application
334-
*/
335-
private @Nullable ActivityManager.MemoryInfo getMemInfo() {
336-
try {
337-
ActivityManager actManager = (ActivityManager) context.getSystemService(ACTIVITY_SERVICE);
338-
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
339-
if (actManager != null) {
340-
actManager.getMemoryInfo(memInfo);
341-
return memInfo;
342-
}
343-
logger.log(SentryLevel.INFO, "Error getting MemoryInfo.");
344-
return null;
345-
} catch (Throwable e) {
346-
logger.log(SentryLevel.ERROR, "Error getting MemoryInfo.", e);
347-
return null;
348-
}
349-
}
350-
351331
@TestOnly
352332
int getTransactionsCounter() {
353333
return transactionsCounter;

sentry-android-core/src/main/java/io/sentry/android/core/AnrV2EventProcessor.java

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,13 @@ private void setApp(final @NotNull SentryBaseEvent event, final @NotNull Object
374374
if (app == null) {
375375
app = new App();
376376
}
377-
app.setAppName(ContextUtils.getApplicationName(context, options.getLogger()));
377+
app.setAppName(ContextUtils.getApplicationName(context));
378378
// TODO: not entirely correct, because we define background ANRs as not the ones of
379379
// IMPORTANCE_FOREGROUND, but this doesn't mean the app was in foreground when an ANR happened
380380
// but it's our best effort for now. We could serialize AppState in theory.
381381
app.setInForeground(!isBackgroundAnr(hint));
382382

383-
final PackageInfo packageInfo =
384-
ContextUtils.getPackageInfo(context, options.getLogger(), buildInfoProvider);
383+
final PackageInfo packageInfo = ContextUtils.getPackageInfo(context, buildInfoProvider);
385384
if (packageInfo != null) {
386385
app.setAppIdentifier(packageInfo.packageName);
387386
}
@@ -597,8 +596,7 @@ private void mergeUser(final @NotNull SentryBaseEvent event) {
597596
private void setSideLoadedInfo(final @NotNull SentryBaseEvent event) {
598597
try {
599598
final ContextUtils.SideLoadedInfo sideLoadedInfo =
600-
ContextUtils.retrieveSideLoadedInfo(context, options.getLogger(), buildInfoProvider);
601-
599+
DeviceInfoUtil.getInstance(context, options).getSideLoadedInfo();
602600
if (sideLoadedInfo != null) {
603601
final @NotNull Map<String, String> tags = sideLoadedInfo.asTags();
604602
for (Map.Entry<String, String> entry : tags.entrySet()) {
@@ -667,7 +665,8 @@ private void setDevice(final @NotNull SentryBaseEvent event) {
667665

668666
private void mergeOS(final @NotNull SentryBaseEvent event) {
669667
final OperatingSystem currentOS = event.getContexts().getOperatingSystem();
670-
final OperatingSystem androidOS = getOperatingSystem();
668+
final OperatingSystem androidOS =
669+
DeviceInfoUtil.getInstance(context, options).getOperatingSystem();
671670

672671
// make Android OS the main OS using the 'os' key
673672
event.getContexts().setOperatingSystem(androidOS);
@@ -683,20 +682,5 @@ private void mergeOS(final @NotNull SentryBaseEvent event) {
683682
event.getContexts().put(osNameKey, currentOS);
684683
}
685684
}
686-
687-
private @NotNull OperatingSystem getOperatingSystem() {
688-
OperatingSystem os = new OperatingSystem();
689-
os.setName("Android");
690-
os.setVersion(Build.VERSION.RELEASE);
691-
os.setBuild(Build.DISPLAY);
692-
693-
try {
694-
os.setKernelVersion(ContextUtils.getKernelVersion(options.getLogger()));
695-
} catch (Throwable e) {
696-
options.getLogger().log(SentryLevel.ERROR, "Error getting OperatingSystem.", e);
697-
}
698-
699-
return os;
700-
}
701685
// endregion
702686
}

0 commit comments

Comments
 (0)