Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/codecov/codecov-ac…
Browse files Browse the repository at this point in the history
…tion-5.3.1
  • Loading branch information
romtsn authored Feb 4, 2025
2 parents e2a92ac + a4fd36f commit 89d6189
Show file tree
Hide file tree
Showing 50 changed files with 768 additions and 836 deletions.
108 changes: 108 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@

## Unreleased

### Fixes

- Do not log if `OtelContextScopesStorage` cannot be found ([#4127](https://github.com/getsentry/sentry-java/pull/4127))
- Previously `java.lang.ClassNotFoundException: io.sentry.opentelemetry.OtelContextScopesStorage` was shown in the log if the class could not be found.
- This is just a lookup the SDK performs to configure itself. The SDK also works without OpenTelemetry.

### Dependencies

- Bump Native SDK from v0.7.19 to v0.7.20 ([#4128](https://github.com/getsentry/sentry-java/pull/4128))
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0720)
- [diff](https://github.com/getsentry/sentry-native/compare/v0.7.19...0.7.20)

## 8.1.0

### Features

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

### Fixes

Expand All @@ -18,6 +33,37 @@
- Remove `java.lang.ClassNotFoundException` debug logs when searching for OpenTelemetry marker classes ([#4091](https://github.com/getsentry/sentry-java/pull/4091))
- 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`.
- These were not indicators of something being wrong but rather the SDK looking at what is available at runtime to configure itself accordingly.
- Do not instrument File I/O operations if tracing is disabled ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
- Do not instrument User Interaction multiple times ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
- Speed up view traversal to find touched target in `UserInteractionIntegration` ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
- Reduce IPC/Binder calls performed by the SDK ([#4058](https://github.com/getsentry/sentry-java/pull/4058))

### Behavioural Changes

- Reduce the number of broadcasts the SDK is subscribed for ([#4052](https://github.com/getsentry/sentry-java/pull/4052))
- Drop `TempSensorBreadcrumbsIntegration`
- Drop `PhoneStateBreadcrumbsIntegration`
- Reduce number of broadcasts in `SystemEventsBreadcrumbsIntegration`

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:

```kotlin
SentryAndroid.init(context) { options ->
options.integrations.removeAll { it is SystemEventsBreadcrumbsIntegration }
options.integrations.add(SystemEventsBreadcrumbsIntegration(context, SystemEventsBreadcrumbsIntegration.getDefaultActions() + listOf(/* your custom actions */)))
}
```

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).
- Set mechanism `type` to `suppressed` for suppressed exceptions ([#4125](https://github.com/getsentry/sentry-java/pull/4125))
- This helps to distinguish an exceptions cause from any suppressed exceptions in the Sentry UI

### Dependencies

- Bump Spring Boot to `3.4.2` ([#4081](https://github.com/getsentry/sentry-java/pull/4081))
- Bump Native SDK from v0.7.14 to v0.7.19 ([#4076](https://github.com/getsentry/sentry-java/pull/4076))
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0719)
- [diff](https://github.com/getsentry/sentry-native/compare/v0.7.14...0.7.19)

## 8.0.0

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

## 7.21.0

### Fixes

- Do not instrument File I/O operations if tracing is disabled ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
- Do not instrument User Interaction multiple times ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
- Speed up view traversal to find touched target in `UserInteractionIntegration` ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
- Reduce IPC/Binder calls performed by the SDK ([#4058](https://github.com/getsentry/sentry-java/pull/4058))

### Behavioural Changes

- Reduce the number of broadcasts the SDK is subscribed for ([#4052](https://github.com/getsentry/sentry-java/pull/4052))
- Drop `TempSensorBreadcrumbsIntegration`
- Drop `PhoneStateBreadcrumbsIntegration`
- Reduce number of broadcasts in `SystemEventsBreadcrumbsIntegration`

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:

```kotlin
SentryAndroid.init(context) { options ->
options.integrations.removeAll { it is SystemEventsBreadcrumbsIntegration }
options.integrations.add(SystemEventsBreadcrumbsIntegration(context, SystemEventsBreadcrumbsIntegration.getDefaultActions() + listOf(/* your custom actions */)))
}
```

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).

## 7.21.0-beta.1

### Fixes

- Do not instrument File I/O operations if tracing is disabled ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
- Do not instrument User Interaction multiple times ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
- Speed up view traversal to find touched target in `UserInteractionIntegration` ([#4051](https://github.com/getsentry/sentry-java/pull/4051))
- Reduce IPC/Binder calls performed by the SDK ([#4058](https://github.com/getsentry/sentry-java/pull/4058))

### Behavioural Changes

- Reduce the number of broadcasts the SDK is subscribed for ([#4052](https://github.com/getsentry/sentry-java/pull/4052))
- Drop `TempSensorBreadcrumbsIntegration`
- Drop `PhoneStateBreadcrumbsIntegration`
- Reduce number of broadcasts in `SystemEventsBreadcrumbsIntegration`

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:

```kotlin
SentryAndroid.init(context) { options ->
options.integrations.removeAll { it is SystemEventsBreadcrumbsIntegration }
options.integrations.add(SystemEventsBreadcrumbsIntegration(context, SystemEventsBreadcrumbsIntegration.getDefaultActions() + listOf(/* your custom actions */)))
}
```

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).

## 7.20.1

### Behavioural Changes

- The user ip-address is now only set to `"{{auto}}"` if sendDefaultPii is enabled ([#4071](https://github.com/getsentry/sentry-java/pull/4071))
- This change gives you control over IP address collection directly on the client


## 7.20.0

### Features
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ object Config {
val kotlinStdLib = "stdlib-jdk8"

val springBootVersion = "2.7.5"
val springBoot3Version = "3.4.0"
val springBoot3Version = "3.4.2"
val kotlinCompatibleLanguageVersion = "1.4"

val composeVersion = "1.5.3"
Expand Down Expand Up @@ -153,7 +153,7 @@ object Config {

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

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

object OpenTelemetry {
val otelVersion = "1.44.1"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true

# Release information
versionName=8.0.0
versionName=8.1.0

# Override the SDK name on native crashes on Android
sentryAndroidSdkName=sentry.native.android
Expand Down
27 changes: 13 additions & 14 deletions sentry-android-core/api/sentry-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public final class io/sentry/android/core/DeviceInfoUtil {
public static fun getInstance (Landroid/content/Context;Lio/sentry/android/core/SentryAndroidOptions;)Lio/sentry/android/core/DeviceInfoUtil;
public fun getOperatingSystem ()Lio/sentry/protocol/OperatingSystem;
public fun getSideLoadedInfo ()Lio/sentry/android/core/ContextUtils$SideLoadedInfo;
public fun getTotalMemory ()Ljava/lang/Long;
public static fun isCharging (Landroid/content/Intent;Lio/sentry/SentryOptions;)Ljava/lang/Boolean;
public static fun resetInstance ()V
}
Expand Down Expand Up @@ -248,12 +249,6 @@ public final class io/sentry/android/core/NetworkBreadcrumbsIntegration : io/sen
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
}

public final class io/sentry/android/core/PhoneStateBreadcrumbsIntegration : io/sentry/Integration, java/io/Closeable {
public fun <init> (Landroid/content/Context;)V
public fun close ()V
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
}

public final class io/sentry/android/core/ScreenshotEventProcessor : io/sentry/EventProcessor {
public fun <init> (Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/android/core/BuildInfoProvider;)V
public fun getOrder ()Ljava/lang/Long;
Expand Down Expand Up @@ -382,14 +377,7 @@ public final class io/sentry/android/core/SystemEventsBreadcrumbsIntegration : i
public fun <init> (Landroid/content/Context;)V
public fun <init> (Landroid/content/Context;Ljava/util/List;)V
public fun close ()V
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
}

public final class io/sentry/android/core/TempSensorBreadcrumbsIntegration : android/hardware/SensorEventListener, io/sentry/Integration, java/io/Closeable {
public fun <init> (Landroid/content/Context;)V
public fun close ()V
public fun onAccuracyChanged (Landroid/hardware/Sensor;I)V
public fun onSensorChanged (Landroid/hardware/SensorEvent;)V
public static fun getDefaultActions ()Ljava/util/List;
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
}

Expand Down Expand Up @@ -535,3 +523,14 @@ public class io/sentry/android/core/performance/WindowContentChangedCallback : i
public fun onContentChanged ()V
}

public final class io/sentry/android/core/util/AndroidLazyEvaluator {
public fun <init> (Lio/sentry/android/core/util/AndroidLazyEvaluator$AndroidEvaluator;)V
public fun getValue (Landroid/content/Context;)Ljava/lang/Object;
public fun resetValue ()V
public fun setValue (Ljava/lang/Object;)V
}

public abstract interface class io/sentry/android/core/util/AndroidLazyEvaluator$AndroidEvaluator {
public abstract fun evaluate (Landroid/content/Context;)Ljava/lang/Object;
}

Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,6 @@ static void installDefaultIntegrations(
options.addIntegration(new SystemEventsBreadcrumbsIntegration(context));
options.addIntegration(
new NetworkBreadcrumbsIntegration(context, buildInfoProvider, options.getLogger()));
options.addIntegration(new TempSensorBreadcrumbsIntegration(context));
options.addIntegration(new PhoneStateBreadcrumbsIntegration(context));
if (isReplayAvailable) {
final ReplayIntegration replay =
new ReplayIntegration(context, CurrentDateProvider.getInstance());
Expand All @@ -326,8 +324,8 @@ private static void readDefaultOptionValues(
final @NotNull SentryAndroidOptions options,
final @NotNull Context context,
final @NotNull BuildInfoProvider buildInfoProvider) {
final PackageInfo packageInfo =
ContextUtils.getPackageInfo(context, options.getLogger(), buildInfoProvider);
final @Nullable PackageInfo packageInfo =
ContextUtils.getPackageInfo(context, buildInfoProvider);
if (packageInfo != null) {
// Sets App's release if not set by Manifest
if (options.getRelease() == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package io.sentry.android.core;

import static android.content.Context.ACTIVITY_SERVICE;
import static java.util.concurrent.TimeUnit.SECONDS;

import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.Context;
import android.os.Build;
import android.os.Process;
Expand Down Expand Up @@ -258,9 +256,12 @@ public void bindTransaction(final @NotNull ITransaction transaction) {
transactionsCounter = 0;

String totalMem = "0";
ActivityManager.MemoryInfo memInfo = getMemInfo();
if (memInfo != null) {
totalMem = Long.toString(memInfo.totalMem);
final @Nullable Long memory =
(options instanceof SentryAndroidOptions)
? DeviceInfoUtil.getInstance(context, (SentryAndroidOptions) options).getTotalMemory()
: null;
if (memory != null) {
totalMem = Long.toString(memory);
}
String[] abis = Build.SUPPORTED_ABIS;

Expand Down Expand Up @@ -327,27 +328,6 @@ public void close() {
}
}

/**
* Get MemoryInfo object representing the memory state of the application.
*
* @return MemoryInfo object representing the memory state of the application
*/
private @Nullable ActivityManager.MemoryInfo getMemInfo() {
try {
ActivityManager actManager = (ActivityManager) context.getSystemService(ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
if (actManager != null) {
actManager.getMemoryInfo(memInfo);
return memInfo;
}
logger.log(SentryLevel.INFO, "Error getting MemoryInfo.");
return null;
} catch (Throwable e) {
logger.log(SentryLevel.ERROR, "Error getting MemoryInfo.", e);
return null;
}
}

@TestOnly
int getTransactionsCounter() {
return transactionsCounter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,13 @@ private void setApp(final @NotNull SentryBaseEvent event, final @NotNull Object
if (app == null) {
app = new App();
}
app.setAppName(ContextUtils.getApplicationName(context, options.getLogger()));
app.setAppName(ContextUtils.getApplicationName(context));
// TODO: not entirely correct, because we define background ANRs as not the ones of
// IMPORTANCE_FOREGROUND, but this doesn't mean the app was in foreground when an ANR happened
// but it's our best effort for now. We could serialize AppState in theory.
app.setInForeground(!isBackgroundAnr(hint));

final PackageInfo packageInfo =
ContextUtils.getPackageInfo(context, options.getLogger(), buildInfoProvider);
final PackageInfo packageInfo = ContextUtils.getPackageInfo(context, buildInfoProvider);
if (packageInfo != null) {
app.setAppIdentifier(packageInfo.packageName);
}
Expand Down Expand Up @@ -597,8 +596,7 @@ private void mergeUser(final @NotNull SentryBaseEvent event) {
private void setSideLoadedInfo(final @NotNull SentryBaseEvent event) {
try {
final ContextUtils.SideLoadedInfo sideLoadedInfo =
ContextUtils.retrieveSideLoadedInfo(context, options.getLogger(), buildInfoProvider);

DeviceInfoUtil.getInstance(context, options).getSideLoadedInfo();
if (sideLoadedInfo != null) {
final @NotNull Map<String, String> tags = sideLoadedInfo.asTags();
for (Map.Entry<String, String> entry : tags.entrySet()) {
Expand Down Expand Up @@ -667,7 +665,8 @@ private void setDevice(final @NotNull SentryBaseEvent event) {

private void mergeOS(final @NotNull SentryBaseEvent event) {
final OperatingSystem currentOS = event.getContexts().getOperatingSystem();
final OperatingSystem androidOS = getOperatingSystem();
final OperatingSystem androidOS =
DeviceInfoUtil.getInstance(context, options).getOperatingSystem();

// make Android OS the main OS using the 'os' key
event.getContexts().setOperatingSystem(androidOS);
Expand All @@ -683,20 +682,5 @@ private void mergeOS(final @NotNull SentryBaseEvent event) {
event.getContexts().put(osNameKey, currentOS);
}
}

private @NotNull OperatingSystem getOperatingSystem() {
OperatingSystem os = new OperatingSystem();
os.setName("Android");
os.setVersion(Build.VERSION.RELEASE);
os.setBuild(Build.DISPLAY);

try {
os.setKernelVersion(ContextUtils.getKernelVersion(options.getLogger()));
} catch (Throwable e) {
options.getLogger().log(SentryLevel.ERROR, "Error getting OperatingSystem.", e);
}

return os;
}
// endregion
}
Loading

0 comments on commit 89d6189

Please sign in to comment.