Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
- Prevent a class of Session Replay deadlocks by confining lifecycle state changes to Android's main thread ([#5965](https://github.com/getsentry/sentry-java/pull/5965))
- Symbolicate tombstone native frames for libraries loaded directly from APKs ([#5992](https://github.com/getsentry/sentry-java/pull/5992))

### Internal

- Seal `SentryOptions` once `Sentry.init` has finished ([#5999](https://github.com/getsentry/sentry-java/pull/5999))
- Configuring options after `Sentry.init` returns never took effect reliably, because the logger, serializer, executors, transport and profilers are already built from the values they read during init. Such writes are now dropped with an error log, and throw when `debug` is enabled.
- Configure the SDK from the `Sentry.init` callback instead.

### Features

- Add screenshot attachment button to the Android user feedback widget ([#5828](https://github.com/getsentry/sentry-java/pull/5828))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ public boolean isAnrEnabled() {
* @param anrEnabled true for enabled and false for disabled
*/
public void setAnrEnabled(boolean anrEnabled) {
if (rejectAfterSeal("setAnrEnabled")) {
return;
}
this.anrEnabled = anrEnabled;
}

Expand All @@ -332,6 +335,9 @@ public long getAnrTimeoutIntervalMillis() {
* @param anrTimeoutIntervalMillis the timeout internal in Millis
*/
public void setAnrTimeoutIntervalMillis(long anrTimeoutIntervalMillis) {
if (rejectAfterSeal("setAnrTimeoutIntervalMillis")) {
return;
}
this.anrTimeoutIntervalMillis = anrTimeoutIntervalMillis;
}

Expand All @@ -351,6 +357,9 @@ public boolean isAnrReportInDebug() {
* @param anrReportInDebug true for enabled and false for disabled
*/
public void setAnrReportInDebug(boolean anrReportInDebug) {
if (rejectAfterSeal("setAnrReportInDebug")) {
return;
}
this.anrReportInDebug = anrReportInDebug;
}

Expand All @@ -373,6 +382,9 @@ public boolean isEnableNdkAppHangTracking() {
*/
@ApiStatus.Experimental
public void setEnableNdkAppHangTracking(boolean enableNdkAppHangTracking) {
if (rejectAfterSeal("setEnableNdkAppHangTracking")) {
return;
}
this.enableNdkAppHangTracking = enableNdkAppHangTracking;
}

Expand All @@ -395,6 +407,9 @@ public long getNdkAppHangTimeoutIntervalMillis() {
*/
@ApiStatus.Experimental
public void setNdkAppHangTimeoutIntervalMillis(long ndkAppHangTimeoutIntervalMillis) {
if (rejectAfterSeal("setNdkAppHangTimeoutIntervalMillis")) {
return;
}
this.ndkAppHangTimeoutIntervalMillis = ndkAppHangTimeoutIntervalMillis;
}

Expand All @@ -404,6 +419,9 @@ public void setNdkAppHangTimeoutIntervalMillis(long ndkAppHangTimeoutIntervalMil
* @param enableTombstone true for enabled and false for disabled
*/
public void setTombstoneEnabled(boolean enableTombstone) {
if (rejectAfterSeal("setTombstoneEnabled")) {
return;
}
this.enableTombstone = enableTombstone;
}

Expand All @@ -422,6 +440,9 @@ public boolean isEnableActivityLifecycleBreadcrumbs() {
}

public void setEnableActivityLifecycleBreadcrumbs(boolean enableActivityLifecycleBreadcrumbs) {
if (rejectAfterSeal("setEnableActivityLifecycleBreadcrumbs")) {
return;
}
this.enableActivityLifecycleBreadcrumbs = enableActivityLifecycleBreadcrumbs;
}

Expand All @@ -430,6 +451,9 @@ public boolean isEnableAppLifecycleBreadcrumbs() {
}

public void setEnableAppLifecycleBreadcrumbs(boolean enableAppLifecycleBreadcrumbs) {
if (rejectAfterSeal("setEnableAppLifecycleBreadcrumbs")) {
return;
}
this.enableAppLifecycleBreadcrumbs = enableAppLifecycleBreadcrumbs;
}

Expand All @@ -438,6 +462,9 @@ public boolean isEnableSystemEventBreadcrumbs() {
}

public void setEnableSystemEventBreadcrumbs(boolean enableSystemEventBreadcrumbs) {
if (rejectAfterSeal("setEnableSystemEventBreadcrumbs")) {
return;
}
this.enableSystemEventBreadcrumbs = enableSystemEventBreadcrumbs;
}

Expand All @@ -446,6 +473,9 @@ public boolean isEnableAppComponentBreadcrumbs() {
}

public void setEnableAppComponentBreadcrumbs(boolean enableAppComponentBreadcrumbs) {
if (rejectAfterSeal("setEnableAppComponentBreadcrumbs")) {
return;
}
this.enableAppComponentBreadcrumbs = enableAppComponentBreadcrumbs;
}

Expand All @@ -454,6 +484,9 @@ public boolean isEnableNetworkEventBreadcrumbs() {
}

public void setEnableNetworkEventBreadcrumbs(boolean enableNetworkEventBreadcrumbs) {
if (rejectAfterSeal("setEnableNetworkEventBreadcrumbs")) {
return;
}
this.enableNetworkEventBreadcrumbs = enableNetworkEventBreadcrumbs;
}

Expand Down Expand Up @@ -486,6 +519,9 @@ public void enableAllAutoBreadcrumbs(boolean enable) {
* @param debugImagesLoader the image loader
*/
public void setDebugImagesLoader(final @NotNull IDebugImagesLoader debugImagesLoader) {
if (rejectAfterSeal("setDebugImagesLoader")) {
return;
}
this.debugImagesLoader =
debugImagesLoader != null ? debugImagesLoader : NoOpDebugImagesLoader.getInstance();
}
Expand All @@ -495,6 +531,9 @@ public boolean isEnableAutoActivityLifecycleTracing() {
}

public void setEnableAutoActivityLifecycleTracing(boolean enableAutoActivityLifecycleTracing) {
if (rejectAfterSeal("setEnableAutoActivityLifecycleTracing")) {
return;
}
this.enableAutoActivityLifecycleTracing = enableAutoActivityLifecycleTracing;
}

Expand All @@ -504,6 +543,9 @@ public boolean isEnableActivityLifecycleTracingAutoFinish() {

public void setEnableActivityLifecycleTracingAutoFinish(
boolean enableActivityLifecycleTracingAutoFinish) {
if (rejectAfterSeal("setEnableActivityLifecycleTracingAutoFinish")) {
return;
}
this.enableActivityLifecycleTracingAutoFinish = enableActivityLifecycleTracingAutoFinish;
}

Expand All @@ -512,6 +554,9 @@ public boolean isAttachScreenshot() {
}

public void setAttachScreenshot(boolean attachScreenshot) {
if (rejectAfterSeal("setAttachScreenshot")) {
return;
}
this.attachScreenshot = attachScreenshot;
}

Expand All @@ -520,6 +565,9 @@ public boolean isAttachViewHierarchy() {
}

public void setAttachViewHierarchy(boolean attachViewHierarchy) {
if (rejectAfterSeal("setAttachViewHierarchy")) {
return;
}
this.attachViewHierarchy = attachViewHierarchy;
}

Expand All @@ -528,6 +576,9 @@ public boolean isCollectAdditionalContext() {
}

public void setCollectAdditionalContext(boolean collectAdditionalContext) {
if (rejectAfterSeal("setCollectAdditionalContext")) {
return;
}
this.collectAdditionalContext = collectAdditionalContext;
}

Expand All @@ -536,6 +587,9 @@ public boolean isCollectExternalStorageContext() {
}

public void setCollectExternalStorageContext(final boolean collectExternalStorageContext) {
if (rejectAfterSeal("setCollectExternalStorageContext")) {
return;
}
this.collectExternalStorageContext = collectExternalStorageContext;
}

Expand All @@ -549,6 +603,9 @@ public boolean isEnableFramesTracking() {
* @param enableFramesTracking true if frames tracking should be enabled, false otherwise.
*/
public void setEnableFramesTracking(boolean enableFramesTracking) {
if (rejectAfterSeal("setEnableFramesTracking")) {
return;
}
this.enableFramesTracking = enableFramesTracking;
}

Expand Down Expand Up @@ -590,11 +647,17 @@ public long getStartupCrashDurationThresholdMillis() {
*/
@ApiStatus.Internal
public void setNativeSdkName(final @Nullable String nativeSdkName) {
if (rejectAfterSeal("setNativeSdkName")) {
return;
}
this.nativeSdkName = nativeSdkName;
}

@ApiStatus.Internal
public void setNativeHandlerStrategy(final @NotNull NdkHandlerStrategy ndkHandlerStrategy) {
if (rejectAfterSeal("setNativeHandlerStrategy")) {
return;
}
this.ndkHandlerStrategy = ndkHandlerStrategy;
}

Expand All @@ -618,6 +681,9 @@ public boolean isEnableRootCheck() {
}

public void setEnableRootCheck(final boolean enableRootCheck) {
if (rejectAfterSeal("setEnableRootCheck")) {
return;
}
this.enableRootCheck = enableRootCheck;
}

Expand All @@ -633,6 +699,9 @@ public void setEnableRootCheck(final boolean enableRootCheck) {
*/
public void setBeforeScreenshotCaptureCallback(
final @NotNull BeforeCaptureCallback beforeScreenshotCaptureCallback) {
if (rejectAfterSeal("setBeforeScreenshotCaptureCallback")) {
return;
}
this.beforeScreenshotCaptureCallback = beforeScreenshotCaptureCallback;
}

Expand All @@ -648,6 +717,9 @@ public void setBeforeScreenshotCaptureCallback(
*/
public void setBeforeViewHierarchyCaptureCallback(
final @NotNull BeforeCaptureCallback beforeViewHierarchyCaptureCallback) {
if (rejectAfterSeal("setBeforeViewHierarchyCaptureCallback")) {
return;
}
this.beforeViewHierarchyCaptureCallback = beforeViewHierarchyCaptureCallback;
}

Expand Down Expand Up @@ -692,6 +764,9 @@ public boolean isReportHistoricalAnrs() {
}

public void setReportHistoricalAnrs(final boolean reportHistoricalAnrs) {
if (rejectAfterSeal("setReportHistoricalAnrs")) {
return;
}
this.reportHistoricalAnrs = reportHistoricalAnrs;
}

Expand All @@ -700,6 +775,9 @@ public boolean isReportHistoricalTombstones() {
}

public void setReportHistoricalTombstones(final boolean reportHistoricalTombstones) {
if (rejectAfterSeal("setReportHistoricalTombstones")) {
return;
}
this.reportHistoricalTombstones = reportHistoricalTombstones;
}

Expand All @@ -708,6 +786,9 @@ public boolean isAttachAnrThreadDump() {
}

public void setAttachAnrThreadDump(final boolean attachAnrThreadDump) {
if (rejectAfterSeal("setAttachAnrThreadDump")) {
return;
}
this.attachAnrThreadDump = attachAnrThreadDump;
}

Expand All @@ -716,6 +797,9 @@ public boolean isAttachRawTombstone() {
}

public void setAttachRawTombstone(final boolean attachRawTombstone) {
if (rejectAfterSeal("setAttachRawTombstone")) {
return;
}
this.attachRawTombstone = attachRawTombstone;
}

Expand All @@ -736,6 +820,9 @@ public boolean isEnablePerformanceV2() {
* @param enablePerformanceV2 true if enabled or false otherwise
*/
public void setEnablePerformanceV2(final boolean enablePerformanceV2) {
if (rejectAfterSeal("setEnablePerformanceV2")) {
return;
}
this.enablePerformanceV2 = enablePerformanceV2;
}

Expand Down Expand Up @@ -783,6 +870,9 @@ public boolean isEnableStandaloneAppStartTracing() {
*/
@ApiStatus.Experimental
public void setEnableStandaloneAppStartTracing(final boolean enableStandaloneAppStartTracing) {
if (rejectAfterSeal("setEnableStandaloneAppStartTracing")) {
return;
}
this.enableStandaloneAppStartTracing = enableStandaloneAppStartTracing;
}

Expand All @@ -794,6 +884,9 @@ public void setEnableStandaloneAppStartTracing(final boolean enableStandaloneApp
@ApiStatus.Internal
public void setFrameMetricsCollector(
final @Nullable SentryFrameMetricsCollector frameMetricsCollector) {
if (rejectAfterSeal("setFrameMetricsCollector")) {
return;
}
this.frameMetricsCollector = frameMetricsCollector;
}

Expand All @@ -802,6 +895,9 @@ public boolean isEnableAutoTraceIdGeneration() {
}

public void setEnableAutoTraceIdGeneration(final boolean enableAutoTraceIdGeneration) {
if (rejectAfterSeal("setEnableAutoTraceIdGeneration")) {
return;
}
this.enableAutoTraceIdGeneration = enableAutoTraceIdGeneration;
}

Expand All @@ -811,6 +907,9 @@ public boolean isEnableSystemEventBreadcrumbsExtras() {

public void setEnableSystemEventBreadcrumbsExtras(
final boolean enableSystemEventBreadcrumbsExtras) {
if (rejectAfterSeal("setEnableSystemEventBreadcrumbsExtras")) {
return;
}
this.enableSystemEventBreadcrumbsExtras = enableSystemEventBreadcrumbsExtras;
}

Expand All @@ -828,6 +927,9 @@ public void setEnableSystemEventBreadcrumbsExtras(
}

public void setAnrProfilingSampleRate(final @Nullable Double anrProfilingSampleRate) {
if (rejectAfterSeal("setAnrProfilingSampleRate")) {
return;
}
if (!SampleRateUtils.isValidSampleRate(anrProfilingSampleRate)) {
throw new IllegalArgumentException(
"The value "
Expand Down Expand Up @@ -861,6 +963,9 @@ public boolean isEnableAnrFingerprinting() {
* @param enableAnrFingerprinting true to enable ANR fingerprinting
*/
public void setEnableAnrFingerprinting(final boolean enableAnrFingerprinting) {
if (rejectAfterSeal("setEnableAnrFingerprinting")) {
return;
}
this.enableAnrFingerprinting = enableAnrFingerprinting;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package io.sentry.spring.boot4

import com.acme.MainBootClass
import io.opentelemetry.api.OpenTelemetry
import io.sentry.AsyncHttpTransportFactory
import io.sentry.Breadcrumb
import io.sentry.EventProcessor
import io.sentry.FilterString
Expand Down Expand Up @@ -799,8 +798,10 @@ class SentryAutoConfigurationTest {
.withPropertyValues("sentry.dsn=http://key@localhost/proj")
.withClassLoader(FilteredClassLoader(ApacheHttpClientTransportFactory::class.java))
.run {
// Spring installs no factory here; SentryClient resolves the async http one internally
// without writing it back to the options.
assertThat(it.getBean(SentryOptions::class.java).transportFactory)
.isInstanceOf(AsyncHttpTransportFactory::class.java)
.isInstanceOf(NoOpTransportFactory::class.java)
}
}

Expand Down
Loading
Loading