Skip to content

Commit 649c6db

Browse files
authored
Merge branch 'main' into rz/fix/no-window-root-views
2 parents 57f3406 + b9ea522 commit 649c6db

File tree

52 files changed

+761
-153
lines changed

Some content is hidden

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

52 files changed

+761
-153
lines changed

.craft.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ targets:
3434
maven:io.sentry:sentry-apache-http-client-5:
3535
maven:io.sentry:sentry-android:
3636
maven:io.sentry:sentry-android-core:
37+
maven:io.sentry:sentry-android-distribution:
3738
maven:io.sentry:sentry-android-ndk:
3839
maven:io.sentry:sentry-android-timber:
3940
maven:io.sentry:sentry-kotlin-extensions:

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
3737

3838
- name: Initialize CodeQL
39-
uses: github/codeql-action/init@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # pin@v2
39+
uses: github/codeql-action/init@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # pin@v2
4040
with:
4141
languages: 'java'
4242

@@ -45,4 +45,4 @@ jobs:
4545
./gradlew buildForCodeQL --no-build-cache
4646
4747
- name: Perform CodeQL Analysis
48-
uses: github/codeql-action/analyze@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # pin@v2
48+
uses: github/codeql-action/analyze@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # pin@v2

.github/workflows/danger.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ name: Danger
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, reopened, edited, ready_for_review]
5+
types: [opened, synchronize, reopened, edited, ready_for_review, labeled, unlabeled]
66

77
jobs:
88
danger:
9-
uses: getsentry/github-workflows/.github/workflows/danger.yml@v2
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: getsentry/github-workflows/danger@v3

CHANGELOG.md

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

33
## Unreleased
44

5+
### Features
6+
7+
- Attach MDC properties to logs as attributes ([#4786](https://github.com/getsentry/sentry-java/pull/4786))
8+
- MDC properties set using supported logging frameworks (Logback, Log4j2, java.util.Logging) are now attached to structured logs as attributes.
9+
- The attribute reflected on the log is `mdc.<key>`, where `<key>` is the original key in the MDC.
10+
- This means that you will be able to filter/aggregate logs in the product based on these properties.
11+
- Only properties with keys matching the configured `contextTags` are sent as log attributes.
12+
- You can configure which properties are sent using `options.setContextTags` if initalizing manually, or by specifying a comma-separated list of keys with a `context-tags` entry in `sentry.properties` or `sentry.context-tags` in `application.properties`.
13+
- Note that keys containing spaces are not supported.
14+
- Add experimental Sentry Android Distribution module for integrating with Sentry Build Distribution to check for and install updates ([#4804](https://github.com/getsentry/sentry-java/pull/4804))
15+
- Allow passing a different `Handler` to `SystemEventsBreadcrumbsIntegration` and `AndroidConnectionStatusProvider` so their callbacks are deliver to that handler ([#4808](https://github.com/getsentry/sentry-java/pull/4808))
16+
517
### Fixes
618

19+
- Avoid StrictMode warnings ([#4724](https://github.com/getsentry/sentry-java/pull/4724))
720
- Use logger from options for JVM profiler ([#4771](https://github.com/getsentry/sentry-java/pull/4771))
821
- Session Replay: Avoid deadlock when pausing replay if no connection ([#4788](https://github.com/getsentry/sentry-java/pull/4788))
922
- Session Replay: Fix capturing roots with no windows ([#4805](https://github.com/getsentry/sentry-java/pull/4805))

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Sentry SDK for Java and Android
2020
|-----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------- |
2121
| sentry-android | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android) | 21 |
2222
| sentry-android-core | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-core) | 21 |
23+
| sentry-android-distribution | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-distribution/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-distribution) | 21 |
2324
| sentry-android-ndk | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-ndk/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-ndk) | 21 |
2425
| sentry-android-timber | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-timber/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-timber) | 21 |
2526
| sentry-android-fragment | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-fragment/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-fragment) | 21 |

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ subprojects {
161161
}
162162
}
163163

164-
if (!this.name.contains("sample") && !this.name.contains("integration-tests") && this.name != "sentry-system-test-support" && this.name != "sentry-test-support" && this.name != "sentry-android-distribution") {
164+
if (!this.name.contains("sample") && !this.name.contains("integration-tests") && this.name != "sentry-system-test-support" && this.name != "sentry-test-support") {
165165
apply<DistributionPlugin>()
166166
apply<com.vanniktech.maven.publish.MavenPublishPlugin>()
167167

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ androidx-navigation-runtime = { module = "androidx.navigation:navigation-runtime
9191
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidxNavigation" }
9292
androidx-sqlite = { module = "androidx.sqlite:sqlite", version = "2.5.2" }
9393
androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.2.1" }
94+
androidx-browser = { module = "androidx.browser:browser", version = "1.8.0" }
9495
coil-compose = { module = "io.coil-kt:coil-compose", version = "2.6.0" }
9596
commons-compress = {module = "org.apache.commons:commons-compress", version = "1.25.0"}
9697
context-propagation = { module = "io.micrometer:context-propagation", version = "1.1.0" }

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ public class io/sentry/android/core/SpanFrameMetricsCollector : io/sentry/IPerfo
446446

447447
public final class io/sentry/android/core/SystemEventsBreadcrumbsIntegration : io/sentry/Integration, io/sentry/android/core/AppState$AppStateListener, java/io/Closeable {
448448
public fun <init> (Landroid/content/Context;)V
449+
public fun <init> (Landroid/content/Context;Landroid/os/Handler;)V
449450
public fun <init> (Landroid/content/Context;Ljava/util/List;)V
450451
public fun close ()V
451452
public static fun getDefaultActions ()Ljava/util/List;

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import io.sentry.android.core.internal.modules.AssetsModulesLoader;
3131
import io.sentry.android.core.internal.util.AndroidConnectionStatusProvider;
3232
import io.sentry.android.core.internal.util.AndroidCurrentDateProvider;
33+
import io.sentry.android.core.internal.util.AndroidRuntimeManager;
3334
import io.sentry.android.core.internal.util.AndroidThreadChecker;
3435
import io.sentry.android.core.internal.util.SentryFrameMetricsCollector;
3536
import io.sentry.android.core.performance.AppStartMetrics;
@@ -108,7 +109,7 @@ static void loadDefaultAndMetadataOptions(
108109
final @NotNull BuildInfoProvider buildInfoProvider) {
109110
Objects.requireNonNull(context, "The context is required.");
110111

111-
context = ContextUtils.getApplicationContext(context);
112+
@NotNull final Context finalContext = ContextUtils.getApplicationContext(context);
112113

113114
Objects.requireNonNull(options, "The options object is required.");
114115
Objects.requireNonNull(logger, "The ILogger object is required.");
@@ -120,17 +121,22 @@ static void loadDefaultAndMetadataOptions(
120121
options.setDefaultScopeType(ScopeType.CURRENT);
121122
options.setOpenTelemetryMode(SentryOpenTelemetryMode.OFF);
122123
options.setDateProvider(new SentryAndroidDateProvider());
124+
options.setRuntimeManager(new AndroidRuntimeManager());
123125

124126
// set a lower flush timeout on Android to avoid ANRs
125127
options.setFlushTimeoutMillis(DEFAULT_FLUSH_TIMEOUT_MS);
126128

127129
options.setFrameMetricsCollector(
128-
new SentryFrameMetricsCollector(context, logger, buildInfoProvider));
130+
new SentryFrameMetricsCollector(finalContext, logger, buildInfoProvider));
129131

130-
ManifestMetadataReader.applyMetadata(context, options, buildInfoProvider);
131-
options.setCacheDirPath(getCacheDir(context).getAbsolutePath());
132+
ManifestMetadataReader.applyMetadata(finalContext, options, buildInfoProvider);
132133

133-
readDefaultOptionValues(options, context, buildInfoProvider);
134+
options.setCacheDirPath(
135+
options
136+
.getRuntimeManager()
137+
.runWithRelaxedPolicy(() -> getCacheDir(finalContext).getAbsolutePath()));
138+
139+
readDefaultOptionValues(options, finalContext, buildInfoProvider);
134140
AppState.getInstance().registerLifecycleObserver(options);
135141
}
136142

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ private static void deduplicateIntegrations(
232232

233233
final List<Integration> timberIntegrations = new ArrayList<>();
234234
final List<Integration> fragmentIntegrations = new ArrayList<>();
235+
final List<Integration> systemEventsIntegrations = new ArrayList<>();
235236

236237
for (final Integration integration : options.getIntegrations()) {
237238
if (isFragmentAvailable) {
@@ -244,6 +245,9 @@ private static void deduplicateIntegrations(
244245
timberIntegrations.add(integration);
245246
}
246247
}
248+
if (integration instanceof SystemEventsBreadcrumbsIntegration) {
249+
systemEventsIntegrations.add(integration);
250+
}
247251
}
248252

249253
if (fragmentIntegrations.size() > 1) {
@@ -259,5 +263,12 @@ private static void deduplicateIntegrations(
259263
options.getIntegrations().remove(integration);
260264
}
261265
}
266+
267+
if (systemEventsIntegrations.size() > 1) {
268+
for (int i = 0; i < systemEventsIntegrations.size() - 1; i++) {
269+
final Integration integration = systemEventsIntegrations.get(i);
270+
options.getIntegrations().remove(integration);
271+
}
272+
}
262273
}
263274
}

0 commit comments

Comments
 (0)