diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a71b9a0bf..52a428a96a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,9 +15,21 @@ - Manifest option `io.sentry.session-replay.error-sample-rate` was renamed to `io.sentry.session-replay.on-error-sample-rate` ([#3637](https://github.com/getsentry/sentry-java/pull/3637)) - Replace `synchronized` methods and blocks with `ReentrantLock` (`AutoClosableReentrantLock`) ([#3715](https://github.com/getsentry/sentry-java/pull/3715)) - If you are subclassing any Sentry classes, please check if the parent class used `synchronized` before. Please make sure to use the same lock object as the parent class in that case. -- `traceHeaders` method has been removed ([#3718](https://github.com/getsentry/sentry-java/pull/3718)) -- `reportFullDisplayed` method has been removed ([#3717](https://github.com/getsentry/sentry-java/pull/3717)) - - This was a typo, `reportFullyDisplayed` still remains. +- `traceOrigins` option (`io.sentry.traces.tracing-origins` in manifest) has been removed, please use `tracePropagationTargets` (`io.sentry.traces.trace-propagation-targets` in manifest`) instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- `profilingEnabled` option (`io.sentry.traces.profiling.enable` in manifest) has been removed, please use `profilesSampleRate` (`io.sentry.traces.profiling.sample-rate` instead) instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- `shutdownTimeout` option has been removed, please use `shutdownTimeoutMillis` instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- `profilingTracesIntervalMillis` option for Android has been removed ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- `io.sentry.session-tracking.enable` manifest option has been removed ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- `Sentry.traceHeaders()` method has been removed, please use `Sentry.getTraceparent()` instead ([#3718](https://github.com/getsentry/sentry-java/pull/3718)) +- `Sentry.reportFullDisplayed()` method has been removed, please use `Sentry.reportFullyDisplayed()` instead ([#3717](https://github.com/getsentry/sentry-java/pull/3717)) +- `User.other` has been removed, please use `data` instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- `SdkVersion.getIntegrations()` has been removed, please use `getIntegrationSet` instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- `SdkVersion.getPackages()` has been removed, please use `getPackageSet()` instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- `Device.language` has been removed, please use `locale` instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- `TraceContext.user` and `TraceContextUser` class have been removed, please use `userId` on `TraceContext` instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- `TransactionContext.fromSentryTrace()` has been removed, please use `Sentry.continueTrace()` instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- `SentryDataFetcherExceptionHandler` has been removed, please use `SentryGenericDataFetcherExceptionHandler` in combination with `SentryInstrumentation` instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) +- One of the `AndroidTransactionProfiler` constructors has been removed, please use a different one ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) ### Features diff --git a/sentry-android-core/api/sentry-android-core.api b/sentry-android-core/api/sentry-android-core.api index bf70f57cfe..a6e2e4c8de 100644 --- a/sentry-android-core/api/sentry-android-core.api +++ b/sentry-android-core/api/sentry-android-core.api @@ -269,7 +269,6 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr public fun getDebugImagesLoader ()Lio/sentry/android/core/IDebugImagesLoader; public fun getFrameMetricsCollector ()Lio/sentry/android/core/internal/util/SentryFrameMetricsCollector; public fun getNativeSdkName ()Ljava/lang/String; - public fun getProfilingTracesIntervalMillis ()I public fun getStartupCrashDurationThresholdMillis ()J public fun isAnrEnabled ()Z public fun isAnrReportInDebug ()Z @@ -314,7 +313,6 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr public fun setEnableSystemEventBreadcrumbs (Z)V public fun setFrameMetricsCollector (Lio/sentry/android/core/internal/util/SentryFrameMetricsCollector;)V public fun setNativeSdkName (Ljava/lang/String;)V - public fun setProfilingTracesIntervalMillis (I)V public fun setReportHistoricalAnrs (Z)V } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidTransactionProfiler.java b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidTransactionProfiler.java index d1aa3def99..ec80704f82 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidTransactionProfiler.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidTransactionProfiler.java @@ -11,7 +11,6 @@ import android.os.SystemClock; import io.sentry.DateUtils; import io.sentry.ILogger; -import io.sentry.IScopes; import io.sentry.ISentryExecutorService; import io.sentry.ISentryLifecycleToken; import io.sentry.ITransaction; @@ -51,20 +50,6 @@ final class AndroidTransactionProfiler implements ITransactionProfiler { private @NotNull Date profileStartTimestamp; private final @NotNull AutoClosableReentrantLock lock = new AutoClosableReentrantLock(); - /** - * @deprecated please use a constructor that doesn't takes a {@link IScopes} instead, as it would - * be ignored anyway. - */ - @Deprecated - public AndroidTransactionProfiler( - final @NotNull Context context, - final @NotNull SentryAndroidOptions sentryAndroidOptions, - final @NotNull BuildInfoProvider buildInfoProvider, - final @NotNull SentryFrameMetricsCollector frameMetricsCollector, - final @NotNull IScopes scopes) { - this(context, sentryAndroidOptions, buildInfoProvider, frameMetricsCollector); - } - public AndroidTransactionProfiler( final @NotNull Context context, final @NotNull SentryAndroidOptions sentryAndroidOptions, diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java b/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java index e24faec7a0..ccd0fa430d 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java @@ -133,9 +133,6 @@ public Device collectDeviceInformation( } final @NotNull Locale locale = Locale.getDefault(); - if (device.getLanguage() == null) { - device.setLanguage(locale.getLanguage()); - } if (device.getLocale() == null) { device.setLocale(locale.toString()); // eg en_US } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index fd382ceae9..b998cb3306 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -38,9 +38,6 @@ final class ManifestMetadataReader { static final String SDK_NAME = "io.sentry.sdk.name"; static final String SDK_VERSION = "io.sentry.sdk.version"; - // TODO [MAJOR]: remove on 6.x in favor of SESSION_AUTO_TRACKING_ENABLE - static final String SESSION_TRACKING_ENABLE = "io.sentry.session-tracking.enable"; - static final String AUTO_SESSION_TRACKING_ENABLE = "io.sentry.auto-session-tracking.enable"; static final String SESSION_TRACKING_TIMEOUT_INTERVAL_MILLIS = "io.sentry.session-tracking.timeout-interval-millis"; @@ -65,14 +62,9 @@ final class ManifestMetadataReader { static final String TTFD_ENABLE = "io.sentry.traces.time-to-full-display.enable"; - static final String TRACES_PROFILING_ENABLE = "io.sentry.traces.profiling.enable"; static final String PROFILES_SAMPLE_RATE = "io.sentry.traces.profiling.sample-rate"; @ApiStatus.Experimental static final String TRACE_SAMPLING = "io.sentry.traces.trace-sampling"; - - // TODO [MAJOR]: remove in favor of TRACE_PROPAGATION_TARGETS - @Deprecated static final String TRACING_ORIGINS = "io.sentry.traces.tracing-origins"; - static final String TRACE_PROPAGATION_TARGETS = "io.sentry.traces.trace-propagation-targets"; static final String ATTACH_THREADS = "io.sentry.attach-threads"; @@ -150,14 +142,13 @@ static void applyMetadata( options.setAnrEnabled(readBool(metadata, logger, ANR_ENABLE, options.isAnrEnabled())); - // deprecated - final boolean enableSessionTracking = - readBool( - metadata, logger, SESSION_TRACKING_ENABLE, options.isEnableAutoSessionTracking()); - // use enableAutoSessionTracking as fallback options.setEnableAutoSessionTracking( - readBool(metadata, logger, AUTO_SESSION_TRACKING_ENABLE, enableSessionTracking)); + readBool( + metadata, + logger, + AUTO_SESSION_TRACKING_ENABLE, + options.isEnableAutoSessionTracking())); if (options.getSampleRate() == null) { final Double sampleRate = readDouble(metadata, logger, SAMPLE_RATE); @@ -309,9 +300,6 @@ static void applyMetadata( TRACES_ACTIVITY_AUTO_FINISH_ENABLE, options.isEnableActivityLifecycleTracingAutoFinish())); - options.setProfilingEnabled( - readBool(metadata, logger, TRACES_PROFILING_ENABLE, options.isProfilingEnabled())); - if (options.getProfilesSampleRate() == null) { final Double profilesSampleRate = readDouble(metadata, logger, PROFILES_SAMPLE_RATE); if (profilesSampleRate != -1) { @@ -334,15 +322,7 @@ static void applyMetadata( List tracePropagationTargets = readList(metadata, logger, TRACE_PROPAGATION_TARGETS); - // TODO [MAJOR] remove once TRACING_ORIGINS have been removed - if (!metadata.containsKey(TRACE_PROPAGATION_TARGETS) - && (tracePropagationTargets == null || tracePropagationTargets.isEmpty())) { - tracePropagationTargets = readList(metadata, logger, TRACING_ORIGINS); - } - - if ((metadata.containsKey(TRACE_PROPAGATION_TARGETS) - || metadata.containsKey(TRACING_ORIGINS)) - && tracePropagationTargets == null) { + if (metadata.containsKey(TRACE_PROPAGATION_TARGETS) && tracePropagationTargets == null) { options.setTracePropagationTargets(Collections.emptyList()); } else if (tracePropagationTargets != null) { options.setTracePropagationTargets(tracePropagationTargets); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java index fb936555e7..194d5ffeb3 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java @@ -337,27 +337,6 @@ public void enableAllAutoBreadcrumbs(boolean enable) { setEnableUserInteractionBreadcrumbs(enable); } - /** - * Returns the interval for profiling traces in milliseconds. - * - * @return the interval for profiling traces in milliseconds. - * @deprecated has no effect and will be removed in future versions. It now just returns 0. - */ - @Deprecated - @SuppressWarnings("InlineMeSuggester") - public int getProfilingTracesIntervalMillis() { - return 0; - } - - /** - * Sets the interval for profiling traces in milliseconds. - * - * @param profilingTracesIntervalMillis - the interval for profiling traces in milliseconds. - * @deprecated has no effect and will be removed in future versions. - */ - @Deprecated - public void setProfilingTracesIntervalMillis(final int profilingTracesIntervalMillis) {} - /** * Returns the Debug image loader * diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidTransactionProfilerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidTransactionProfilerTest.kt index 32c91547f1..86f95b4430 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidTransactionProfilerTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidTransactionProfilerTest.kt @@ -336,16 +336,6 @@ class AndroidTransactionProfilerTest { assertEquals(0, profiler.transactionsCounter) } - @Test - fun `profiler ignores profilingTracesIntervalMillis`() { - fixture.options.apply { - profilingTracesIntervalMillis = 0 - } - val profiler = fixture.getSut(context) - profiler.start() - assertEquals(1, profiler.transactionsCounter) - } - @Test fun `profiler never use background threads`() { val profiler = fixture.getSut(context) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt index c4fef01cc2..9aac83ebad 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt @@ -493,12 +493,11 @@ class DefaultAndroidEventProcessorTest { } @Test - fun `Event sets language and locale`() { + fun `Event sets locale`() { val sut = fixture.getSut(context) assertNotNull(sut.process(SentryEvent(), Hint())) { val device = it.contexts.device!! - assertEquals("en", device.language) assertEquals("en_US", device.locale) } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index 6ab02262c7..3705da44e6 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -106,19 +106,6 @@ class ManifestMetadataReaderTest { assertNull(fixture.options.sampleRate) } - @Test - fun `applyMetadata reads session tracking to options`() { - // Arrange - val bundle = bundleOf(ManifestMetadataReader.SESSION_TRACKING_ENABLE to false) - val context = fixture.getContext(metaData = bundle) - - // Act - ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) - - // Assert - assertFalse(fixture.options.isEnableAutoSessionTracking) - } - @Test fun `applyMetadata reads session tracking and keep default value if not found`() { // Arrange @@ -747,31 +734,6 @@ class ManifestMetadataReaderTest { assertTrue(fixture.options.isTraceSampling) } - @Test - fun `applyMetadata reads enableTracesProfiling to options`() { - // Arrange - val bundle = bundleOf(ManifestMetadataReader.TRACES_PROFILING_ENABLE to true) - val context = fixture.getContext(metaData = bundle) - - // Act - ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) - - // Assert - assertTrue(fixture.options.isProfilingEnabled) - } - - @Test - fun `applyMetadata reads enableTracesProfiling to options and keeps default`() { - // Arrange - val context = fixture.getContext() - - // Act - ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) - - // Assert - assertFalse(fixture.options.isProfilingEnabled) - } - @Test fun `applyMetadata reads profilesSampleRate from metadata`() { // Arrange @@ -826,67 +788,6 @@ class ManifestMetadataReaderTest { assertEquals(listOf("localhost", """^(http|https)://api\..*$"""), fixture.options.tracePropagationTargets) } - @Test - fun `applyMetadata ignores tracingOrigins if tracePropagationTargets is present`() { - // Arrange - val bundle = bundleOf( - ManifestMetadataReader.TRACE_PROPAGATION_TARGETS to """localhost,^(http|https)://api\..*$""", - ManifestMetadataReader.TRACING_ORIGINS to """otherhost""" - ) - val context = fixture.getContext(metaData = bundle) - - // Act - ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) - - // Assert - assertEquals(listOf("localhost", """^(http|https)://api\..*$"""), fixture.options.tracePropagationTargets) - } - - @Test - fun `applyMetadata ignores tracingOrigins if tracePropagationTargets is present even if null`() { - // Arrange - val bundle = bundleOf( - ManifestMetadataReader.TRACE_PROPAGATION_TARGETS to null, - ManifestMetadataReader.TRACING_ORIGINS to """otherhost""" - ) - val context = fixture.getContext(metaData = bundle) - - // Act - ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) - - // Assert - assertTrue(fixture.options.tracePropagationTargets.isEmpty()) - } - - @Test - fun `applyMetadata ignores tracingOrigins if tracePropagationTargets is present even if empty string`() { - // Arrange - val bundle = bundleOf( - ManifestMetadataReader.TRACE_PROPAGATION_TARGETS to "", - ManifestMetadataReader.TRACING_ORIGINS to """otherhost""" - ) - val context = fixture.getContext(metaData = bundle) - - // Act - ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) - - // Assert - assertTrue(fixture.options.tracePropagationTargets.isEmpty()) - } - - @Test - fun `applyMetadata uses tracingOrigins if tracePropagationTargets is not present`() { - // Arrange - val bundle = bundleOf(ManifestMetadataReader.TRACING_ORIGINS to """otherhost""") - val context = fixture.getContext(metaData = bundle) - - // Act - ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) - - // Assert - assertEquals(listOf("otherhost"), fixture.options.tracePropagationTargets) - } - @Test fun `applyMetadata reads null tracePropagationTargets and sets empty list`() { // Arrange diff --git a/sentry-graphql-core/api/sentry-graphql-core.api b/sentry-graphql-core/api/sentry-graphql-core.api index 95dede49a2..7b63e2270d 100644 --- a/sentry-graphql-core/api/sentry-graphql-core.api +++ b/sentry-graphql-core/api/sentry-graphql-core.api @@ -30,13 +30,6 @@ public final class io/sentry/graphql/NoOpSubscriptionHandler : io/sentry/graphql public fun onSubscriptionResult (Ljava/lang/Object;Lio/sentry/IScopes;Lio/sentry/graphql/ExceptionReporter;Lgraphql/execution/instrumentation/parameters/InstrumentationFieldFetchParameters;)Ljava/lang/Object; } -public final class io/sentry/graphql/SentryDataFetcherExceptionHandler : graphql/execution/DataFetcherExceptionHandler { - public fun (Lgraphql/execution/DataFetcherExceptionHandler;)V - public fun (Lio/sentry/IScopes;Lgraphql/execution/DataFetcherExceptionHandler;)V - public fun handleException (Lgraphql/execution/DataFetcherExceptionHandlerParameters;)Ljava/util/concurrent/CompletableFuture; - public fun onException (Lgraphql/execution/DataFetcherExceptionHandlerParameters;)Lgraphql/execution/DataFetcherExceptionHandlerResult; -} - public final class io/sentry/graphql/SentryGenericDataFetcherExceptionHandler : graphql/execution/DataFetcherExceptionHandler { public fun (Lgraphql/execution/DataFetcherExceptionHandler;)V public fun (Lio/sentry/IScopes;Lgraphql/execution/DataFetcherExceptionHandler;)V diff --git a/sentry-graphql-core/src/main/java/io/sentry/graphql/SentryDataFetcherExceptionHandler.java b/sentry-graphql-core/src/main/java/io/sentry/graphql/SentryDataFetcherExceptionHandler.java deleted file mode 100644 index 0813aab851..0000000000 --- a/sentry-graphql-core/src/main/java/io/sentry/graphql/SentryDataFetcherExceptionHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -package io.sentry.graphql; - -import static io.sentry.TypeCheckHint.GRAPHQL_HANDLER_PARAMETERS; - -import graphql.execution.DataFetcherExceptionHandler; -import graphql.execution.DataFetcherExceptionHandlerParameters; -import graphql.execution.DataFetcherExceptionHandlerResult; -import io.sentry.Hint; -import io.sentry.IScopes; -import io.sentry.ScopesAdapter; -import io.sentry.SentryIntegrationPackageStorage; -import io.sentry.util.Objects; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Captures exceptions that occur during data fetching, passes them to Sentry and invokes a delegate - * exception handler. - * - * @deprecated please use {@link SentryGenericDataFetcherExceptionHandler} in combination with - * {@link SentryInstrumentation} instead for better error reporting. - */ -@Deprecated -public final class SentryDataFetcherExceptionHandler implements DataFetcherExceptionHandler { - private final @NotNull IScopes scopes; - private final @NotNull DataFetcherExceptionHandler delegate; - - public SentryDataFetcherExceptionHandler( - final @NotNull IScopes scopes, final @NotNull DataFetcherExceptionHandler delegate) { - this.scopes = Objects.requireNonNull(scopes, "scopes are required"); - this.delegate = Objects.requireNonNull(delegate, "delegate is required"); - SentryIntegrationPackageStorage.getInstance().addIntegration("GrahQLLegacyExceptionHandler"); - } - - public SentryDataFetcherExceptionHandler(final @NotNull DataFetcherExceptionHandler delegate) { - this(ScopesAdapter.getInstance(), delegate); - } - - @Override - public CompletableFuture handleException( - DataFetcherExceptionHandlerParameters handlerParameters) { - final Hint hint = new Hint(); - hint.set(GRAPHQL_HANDLER_PARAMETERS, handlerParameters); - - scopes.captureException(handlerParameters.getException(), hint); - return delegate.handleException(handlerParameters); - } - - @SuppressWarnings("deprecation") - public DataFetcherExceptionHandlerResult onException( - final @NotNull DataFetcherExceptionHandlerParameters handlerParameters) { - final @Nullable CompletableFuture futureResult = - handleException(handlerParameters); - - if (futureResult != null) { - try { - return futureResult.get(); - } catch (InterruptedException | ExecutionException e) { - return DataFetcherExceptionHandlerResult.newResult().build(); - } - } else { - return DataFetcherExceptionHandlerResult.newResult().build(); - } - } -} diff --git a/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/SentryDataFetcherExceptionHandlerTest.kt b/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/SentryDataFetcherExceptionHandlerTest.kt deleted file mode 100644 index de51abac21..0000000000 --- a/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/SentryDataFetcherExceptionHandlerTest.kt +++ /dev/null @@ -1,28 +0,0 @@ -package io.sentry.graphql - -import graphql.execution.DataFetcherExceptionHandler -import graphql.execution.DataFetcherExceptionHandlerParameters -import io.sentry.Hint -import io.sentry.IScopes -import org.mockito.kotlin.anyOrNull -import org.mockito.kotlin.eq -import org.mockito.kotlin.mock -import org.mockito.kotlin.verify -import kotlin.test.Test - -class SentryDataFetcherExceptionHandlerTest { - - @Test - fun `passes exception to Sentry and invokes delegate`() { - val scopes = mock() - val delegate = mock() - val handler = SentryDataFetcherExceptionHandler(scopes, delegate) - - val exception = RuntimeException() - val parameters = DataFetcherExceptionHandlerParameters.newExceptionParameters().exception(exception).build() - handler.onException(parameters) - - verify(scopes).captureException(eq(exception), anyOrNull()) - verify(delegate).handleException(parameters) - } -} diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt index c8dec3ce6e..649b536442 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt @@ -142,7 +142,7 @@ class SentryAutoConfigurationTest { contextRunner.withPropertyValues( "sentry.dsn=http://key@localhost/proj", "sentry.read-timeout-millis=10", - "sentry.shutdown-timeout=20", + "sentry.shutdown-timeout-millis=20", "sentry.flush-timeout-millis=30", "sentry.debug=true", "sentry.diagnostic-level=INFO", @@ -243,17 +243,6 @@ class SentryAutoConfigurationTest { } } - @Test - fun `when setting tracingOrigins it still works`() { - contextRunner.withPropertyValues( - "sentry.dsn=http://key@localhost/proj", - "sentry.tracing-origins=somehost,otherhost" - ).run { - val options = it.getBean(SentryProperties::class.java) - assertThat(options.tracePropagationTargets).isNotNull().isEqualTo(listOf("somehost", "otherhost")) - } - } - @Test fun `when traces sample rate is set to null and tracing is enabled, traces sample rate should be set to 0`() { contextRunner.withPropertyValues( diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt index 36ead78217..173a8586f8 100644 --- a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt @@ -141,7 +141,7 @@ class SentryAutoConfigurationTest { contextRunner.withPropertyValues( "sentry.dsn=http://key@localhost/proj", "sentry.read-timeout-millis=10", - "sentry.shutdown-timeout=20", + "sentry.shutdown-timeout-millis=20", "sentry.flush-timeout-millis=30", "sentry.debug=true", "sentry.diagnostic-level=INFO", @@ -242,17 +242,6 @@ class SentryAutoConfigurationTest { } } - @Test - fun `when setting tracingOrigins it still works`() { - contextRunner.withPropertyValues( - "sentry.dsn=http://key@localhost/proj", - "sentry.tracing-origins=somehost,otherhost" - ).run { - val options = it.getBean(SentryProperties::class.java) - assertThat(options.tracePropagationTargets).isNotNull().isEqualTo(listOf("somehost", "otherhost")) - } - } - @Test fun `when traces sample rate is set to null and tracing is enabled, traces sample rate should be set to 0`() { contextRunner.withPropertyValues( diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryUserFilterTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryUserFilterTest.kt index b30dc937e5..4d16205253 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryUserFilterTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryUserFilterTest.kt @@ -37,7 +37,7 @@ class SentryUserFilterTest { id = "user-id" ipAddress = "192.168.0.1" email = "john.doe@example.com" - others = mapOf("key" to "value") + data = mapOf("key" to "value") } @Test @@ -105,12 +105,12 @@ class SentryUserFilterTest { userProviders = listOf( SentryUserProvider { User().apply { - others = mapOf("key" to "value") + data = mapOf("key" to "value") } }, SentryUserProvider { User().apply { - others = mapOf("new-key" to "new-value") + data = mapOf("new-key" to "new-value") } } ) @@ -120,7 +120,7 @@ class SentryUserFilterTest { verify(fixture.scopes).setUser( check { - assertEquals(mapOf("key" to "value", "new-key" to "new-value"), it.others) + assertEquals(mapOf("key" to "value", "new-key" to "new-value"), it.data) } ) } @@ -174,6 +174,6 @@ class SentryUserFilterTest { assertEquals(user1.id, user2.id) assertEquals(user1.ipAddress, user2.ipAddress) assertEquals(user1.email, user2.email) - assertEquals(user1.others, user2.others) + assertEquals(user1.data, user2.data) } } diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/SentryUserFilterTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/SentryUserFilterTest.kt index 7f9be1ba8b..e7a152bb2e 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/SentryUserFilterTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/SentryUserFilterTest.kt @@ -37,7 +37,7 @@ class SentryUserFilterTest { id = "user-id" ipAddress = "192.168.0.1" email = "john.doe@example.com" - others = mapOf("key" to "value") + data = mapOf("key" to "value") } @Test @@ -100,17 +100,17 @@ class SentryUserFilterTest { } @Test - fun `merges user#others with existing user#others set on SentryEvent`() { + fun `merges user#data with existing user#data set on SentryEvent`() { val filter = fixture.getSut( userProviders = listOf( SentryUserProvider { User().apply { - others = mapOf("key" to "value") + data = mapOf("key" to "value") } }, SentryUserProvider { User().apply { - others = mapOf("new-key" to "new-value") + data = mapOf("new-key" to "new-value") } } ) @@ -120,7 +120,7 @@ class SentryUserFilterTest { verify(fixture.scopes).setUser( check { - assertEquals(mapOf("key" to "value", "new-key" to "new-value"), it.others) + assertEquals(mapOf("key" to "value", "new-key" to "new-value"), it.data) } ) } @@ -174,6 +174,6 @@ class SentryUserFilterTest { assertEquals(user1.id, user2.id) assertEquals(user1.ipAddress, user2.ipAddress) assertEquals(user1.email, user2.email) - assertEquals(user1.others, user2.others) + assertEquals(user1.data, user2.data) } } diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index bccf6a8518..8a8a37e931 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -437,7 +437,6 @@ public final class io/sentry/ExternalOptions { public fun addInAppExclude (Ljava/lang/String;)V public fun addInAppInclude (Ljava/lang/String;)V public fun addTracePropagationTarget (Ljava/lang/String;)V - public fun addTracingOrigin (Ljava/lang/String;)V public static fun from (Lio/sentry/config/PropertiesProvider;Lio/sentry/ILogger;)Lio/sentry/ExternalOptions; public fun getBundleIds ()Ljava/util/Set; public fun getContextTags ()Ljava/util/List; @@ -465,7 +464,6 @@ public final class io/sentry/ExternalOptions { public fun getTags ()Ljava/util/Map; public fun getTracePropagationTargets ()Ljava/util/List; public fun getTracesSampleRate ()Ljava/lang/Double; - public fun getTracingOrigins ()Ljava/util/List; public fun isEnableBackpressureHandling ()Ljava/lang/Boolean; public fun isEnablePrettySerializationOutput ()Ljava/lang/Boolean; public fun isEnableSpotlight ()Ljava/lang/Boolean; @@ -2779,7 +2777,6 @@ public class io/sentry/SentryOptions { public fun addOptionsObserver (Lio/sentry/IOptionsObserver;)V public fun addPerformanceCollector (Lio/sentry/IPerformanceCollector;)V public fun addScopeObserver (Lio/sentry/IScopeObserver;)V - public fun addTracingOrigin (Ljava/lang/String;)V public static fun empty ()Lio/sentry/SentryOptions; public fun getBackpressureMonitor ()Lio/sentry/backpressure/IBackpressureMonitor; public fun getBeforeBreadcrumb ()Lio/sentry/SentryOptions$BeforeBreadcrumbCallback; @@ -2849,7 +2846,6 @@ public class io/sentry/SentryOptions { public fun getServerName ()Ljava/lang/String; public fun getSessionFlushTimeoutMillis ()J public fun getSessionTrackingIntervalMillis ()J - public fun getShutdownTimeout ()J public fun getShutdownTimeoutMillis ()J public fun getSpanFactory ()Lio/sentry/ISpanFactory; public fun getSpotlightConnectionUrl ()Ljava/lang/String; @@ -2859,7 +2855,6 @@ public class io/sentry/SentryOptions { public fun getTracePropagationTargets ()Ljava/util/List; public fun getTracesSampleRate ()Ljava/lang/Double; public fun getTracesSampler ()Lio/sentry/SentryOptions$TracesSamplerCallback; - public fun getTracingOrigins ()Ljava/util/List; public fun getTransactionPerformanceCollector ()Lio/sentry/TransactionPerformanceCollector; public fun getTransactionProfiler ()Lio/sentry/ITransactionProfiler; public fun getTransportFactory ()Lio/sentry/ITransportFactory; @@ -2954,7 +2949,6 @@ public class io/sentry/SentryOptions { public fun setPrintUncaughtStackTrace (Z)V public fun setProfilesSampleRate (Ljava/lang/Double;)V public fun setProfilesSampler (Lio/sentry/SentryOptions$ProfilesSamplerCallback;)V - public fun setProfilingEnabled (Z)V public fun setProfilingTracesHz (I)V public fun setProguardUuid (Ljava/lang/String;)V public fun setProxy (Lio/sentry/SentryOptions$Proxy;)V @@ -2971,7 +2965,6 @@ public class io/sentry/SentryOptions { public fun setServerName (Ljava/lang/String;)V public fun setSessionFlushTimeoutMillis (J)V public fun setSessionTrackingIntervalMillis (J)V - public fun setShutdownTimeout (J)V public fun setShutdownTimeoutMillis (J)V public fun setSpanFactory (Lio/sentry/ISpanFactory;)V public fun setSpotlightConnectionUrl (Ljava/lang/String;)V @@ -2983,7 +2976,6 @@ public class io/sentry/SentryOptions { public fun setTraceSampling (Z)V public fun setTracesSampleRate (Ljava/lang/Double;)V public fun setTracesSampler (Lio/sentry/SentryOptions$TracesSamplerCallback;)V - public fun setTracingOrigins (Ljava/util/List;)V public fun setTransactionPerformanceCollector (Lio/sentry/TransactionPerformanceCollector;)V public fun setTransactionProfiler (Lio/sentry/ITransactionProfiler;)V public fun setTransportFactory (Lio/sentry/ITransportFactory;)V @@ -3576,7 +3568,6 @@ public final class io/sentry/TraceContext$JsonKeys { public static final field SAMPLE_RATE Ljava/lang/String; public static final field TRACE_ID Ljava/lang/String; public static final field TRANSACTION Ljava/lang/String; - public static final field USER Ljava/lang/String; public static final field USER_ID Ljava/lang/String; public fun ()V } @@ -3604,7 +3595,6 @@ public final class io/sentry/TransactionContext : io/sentry/SpanContext { public fun (Ljava/lang/String;Ljava/lang/String;)V public fun (Ljava/lang/String;Ljava/lang/String;Lio/sentry/TracesSamplingDecision;)V public static fun fromPropagationContext (Lio/sentry/PropagationContext;)Lio/sentry/TransactionContext; - public static fun fromSentryTrace (Ljava/lang/String;Ljava/lang/String;Lio/sentry/SentryTraceHeader;)Lio/sentry/TransactionContext; public fun getName ()Ljava/lang/String; public fun getParentSampled ()Ljava/lang/Boolean; public fun getParentSamplingDecision ()Lio/sentry/TracesSamplingDecision; @@ -4440,7 +4430,6 @@ public final class io/sentry/protocol/Device : io/sentry/JsonSerializable, io/se public fun getFreeMemory ()Ljava/lang/Long; public fun getFreeStorage ()Ljava/lang/Long; public fun getId ()Ljava/lang/String; - public fun getLanguage ()Ljava/lang/String; public fun getLocale ()Ljava/lang/String; public fun getManufacturer ()Ljava/lang/String; public fun getMemorySize ()Ljava/lang/Long; @@ -4478,7 +4467,6 @@ public final class io/sentry/protocol/Device : io/sentry/JsonSerializable, io/se public fun setFreeMemory (Ljava/lang/Long;)V public fun setFreeStorage (Ljava/lang/Long;)V public fun setId (Ljava/lang/String;)V - public fun setLanguage (Ljava/lang/String;)V public fun setLocale (Ljava/lang/String;)V public fun setLowMemory (Ljava/lang/Boolean;)V public fun setManufacturer (Ljava/lang/String;)V @@ -4536,7 +4524,6 @@ public final class io/sentry/protocol/Device$JsonKeys { public static final field FREE_MEMORY Ljava/lang/String; public static final field FREE_STORAGE Ljava/lang/String; public static final field ID Ljava/lang/String; - public static final field LANGUAGE Ljava/lang/String; public static final field LOCALE Ljava/lang/String; public static final field LOW_MEMORY Ljava/lang/String; public static final field MANUFACTURER Ljava/lang/String; @@ -4898,10 +4885,8 @@ public final class io/sentry/protocol/SdkVersion : io/sentry/JsonSerializable, i public fun addPackage (Ljava/lang/String;Ljava/lang/String;)V public fun equals (Ljava/lang/Object;)Z public fun getIntegrationSet ()Ljava/util/Set; - public fun getIntegrations ()Ljava/util/List; public fun getName ()Ljava/lang/String; public fun getPackageSet ()Ljava/util/Set; - public fun getPackages ()Ljava/util/List; public fun getUnknown ()Ljava/util/Map; public fun getVersion ()Ljava/lang/String; public fun hashCode ()I @@ -5301,7 +5286,6 @@ public final class io/sentry/protocol/User : io/sentry/JsonSerializable, io/sent public fun getId ()Ljava/lang/String; public fun getIpAddress ()Ljava/lang/String; public fun getName ()Ljava/lang/String; - public fun getOthers ()Ljava/util/Map; public fun getUnknown ()Ljava/util/Map; public fun getUsername ()Ljava/lang/String; public fun hashCode ()I @@ -5312,7 +5296,6 @@ public final class io/sentry/protocol/User : io/sentry/JsonSerializable, io/sent public fun setId (Ljava/lang/String;)V public fun setIpAddress (Ljava/lang/String;)V public fun setName (Ljava/lang/String;)V - public fun setOthers (Ljava/util/Map;)V public fun setUnknown (Ljava/util/Map;)V public fun setUsername (Ljava/lang/String;)V } @@ -5330,7 +5313,6 @@ public final class io/sentry/protocol/User$JsonKeys { public static final field ID Ljava/lang/String; public static final field IP_ADDRESS Ljava/lang/String; public static final field NAME Ljava/lang/String; - public static final field OTHER Ljava/lang/String; public static final field USERNAME Ljava/lang/String; public fun ()V } diff --git a/sentry/src/main/java/io/sentry/ExternalOptions.java b/sentry/src/main/java/io/sentry/ExternalOptions.java index 728671c43c..75b67dc766 100644 --- a/sentry/src/main/java/io/sentry/ExternalOptions.java +++ b/sentry/src/main/java/io/sentry/ExternalOptions.java @@ -243,11 +243,6 @@ public void setEnableUncaughtExceptionHandler( this.enableUncaughtExceptionHandler = enableUncaughtExceptionHandler; } - @Deprecated - public @Nullable List getTracingOrigins() { - return tracePropagationTargets; - } - public @Nullable List getTracePropagationTargets() { return tracePropagationTargets; } @@ -336,12 +331,6 @@ public void addInAppExclude(final @NotNull String exclude) { inAppExcludes.add(exclude); } - @Deprecated - @SuppressWarnings("InlineMeSuggester") - public void addTracingOrigin(final @NotNull String tracingOrigin) { - this.addTracePropagationTarget(tracingOrigin); - } - public void addTracePropagationTarget(final @NotNull String tracePropagationTarget) { if (tracePropagationTargets == null) { tracePropagationTargets = new CopyOnWriteArrayList<>(); diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index 8c8b445ed7..fc47b10d71 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -649,18 +649,6 @@ public void setEnvelopeReader(final @Nullable IEnvelopeReader envelopeReader) { envelopeReader != null ? envelopeReader : NoOpEnvelopeReader.getInstance(); } - /** - * Returns the shutdown timeout in Millis - * - * @deprecated use {{@link SentryOptions#getShutdownTimeoutMillis()} } - * @return the timeout in Millis - */ - @ApiStatus.ScheduledForRemoval - @Deprecated - public long getShutdownTimeout() { - return shutdownTimeoutMillis; - } - /** * Returns the shutdown timeout in Millis * @@ -670,18 +658,6 @@ public long getShutdownTimeoutMillis() { return shutdownTimeoutMillis; } - /** - * Sets the shutdown timeout in Millis Default is 2000 = 2s - * - * @deprecated use {{@link SentryOptions#setShutdownTimeoutMillis(long)} } - * @param shutdownTimeoutMillis the shutdown timeout in millis - */ - @ApiStatus.ScheduledForRemoval - @Deprecated - public void setShutdownTimeout(long shutdownTimeoutMillis) { - this.shutdownTimeoutMillis = shutdownTimeoutMillis; - } - /** * Sets the shutdown timeout in Millis Default is 2000 = 2s * @@ -1676,19 +1652,6 @@ public boolean isProfilingEnabled() { || getProfilesSampler() != null; } - /** - * Sets whether profiling is enabled for transactions. - * - * @deprecated use {{@link SentryOptions#setProfilesSampleRate(Double)} } - * @param profilingEnabled - whether profiling is enabled for transactions - */ - @Deprecated - public void setProfilingEnabled(boolean profilingEnabled) { - if (getProfilesSampleRate() == null) { - setProfilesSampleRate(profilingEnabled ? 1.0 : null); - } - } - /** * Returns the callback used to determine if a profile is sampled. * @@ -1746,42 +1709,6 @@ public void setProfilesSampleRate(final @Nullable Double profilesSampleRate) { return new File(cacheDirPath, "profiling_traces").getAbsolutePath(); } - /** - * Returns a list of origins to which `sentry-trace` header should be sent in HTTP integrations. - * - * @deprecated use {{@link SentryOptions#getTracePropagationTargets()} } - * @return the list of origins - */ - @Deprecated - @SuppressWarnings("InlineMeSuggester") - public @NotNull List getTracingOrigins() { - return getTracePropagationTargets(); - } - - /** - * Adds an origin to which `sentry-trace` header should be sent in HTTP integrations. - * - * @deprecated use {{@link SentryOptions#setTracePropagationTargets(List)}} - * @param tracingOrigin - the tracing origin - */ - @Deprecated - @SuppressWarnings("InlineMeSuggester") - public void addTracingOrigin(final @NotNull String tracingOrigin) { - if (tracePropagationTargets == null) { - tracePropagationTargets = new CopyOnWriteArrayList<>(); - } - if (!tracingOrigin.isEmpty()) { - tracePropagationTargets.add(tracingOrigin); - } - } - - @Deprecated - @SuppressWarnings("InlineMeSuggester") - @ApiStatus.Internal - public void setTracingOrigins(final @Nullable List tracingOrigins) { - setTracePropagationTargets(tracingOrigins); - } - /** * Returns a list of origins to which `sentry-trace` header should be sent in HTTP integrations. * diff --git a/sentry/src/main/java/io/sentry/TraceContext.java b/sentry/src/main/java/io/sentry/TraceContext.java index 0d0799d8d3..bb32022f60 100644 --- a/sentry/src/main/java/io/sentry/TraceContext.java +++ b/sentry/src/main/java/io/sentry/TraceContext.java @@ -96,70 +96,6 @@ public final class TraceContext implements JsonUnknown, JsonSerializable { return replayId; } - /** - * @deprecated only here to support parsing legacy JSON with non flattened user - */ - @Deprecated - private static final class TraceContextUser implements JsonUnknown { - private final @Nullable String id; - - @SuppressWarnings("unused") - private @Nullable Map unknown; - - private TraceContextUser(final @Nullable String id) { - this.id = id; - } - - public @Nullable String getId() { - return id; - } - - // region json - - @Nullable - @Override - public Map getUnknown() { - return unknown; - } - - @Override - public void setUnknown(@Nullable Map unknown) { - this.unknown = unknown; - } - - public static final class JsonKeys { - public static final String ID = "id"; - } - - public static final class Deserializer implements JsonDeserializer { - @Override - public @NotNull TraceContextUser deserialize( - @NotNull ObjectReader reader, @NotNull ILogger logger) throws Exception { - reader.beginObject(); - - String id = null; - Map unknown = null; - while (reader.peek() == JsonToken.NAME) { - final String nextName = reader.nextName(); - if (nextName.equals(JsonKeys.ID)) { - id = reader.nextStringOrNull(); - } else { - if (unknown == null) { - unknown = new ConcurrentHashMap<>(); - } - reader.nextUnknown(logger, unknown, nextName); - } - } - TraceContextUser traceStateUser = new TraceContextUser(id); - traceStateUser.setUnknown(unknown); - reader.endObject(); - return traceStateUser; - } - } - - // endregion - } - // region json @Nullable @@ -178,7 +114,6 @@ public static final class JsonKeys { public static final String PUBLIC_KEY = "public_key"; public static final String RELEASE = "release"; public static final String ENVIRONMENT = "environment"; - public static final String USER = "user"; public static final String USER_ID = "user_id"; public static final String TRANSACTION = "transaction"; public static final String SAMPLE_RATE = "sample_rate"; @@ -233,7 +168,6 @@ public static final class Deserializer implements JsonDeserializer String publicKey = null; String release = null; String environment = null; - TraceContextUser user = null; String userId = null; String transaction = null; String sampleRate = null; @@ -256,9 +190,6 @@ public static final class Deserializer implements JsonDeserializer case TraceContext.JsonKeys.ENVIRONMENT: environment = reader.nextStringOrNull(); break; - case TraceContext.JsonKeys.USER: - user = reader.nextOrNull(logger, new TraceContextUser.Deserializer()); - break; case TraceContext.JsonKeys.USER_ID: userId = reader.nextStringOrNull(); break; @@ -288,11 +219,6 @@ public static final class Deserializer implements JsonDeserializer if (publicKey == null) { throw missingRequiredFieldException(TraceContext.JsonKeys.PUBLIC_KEY, logger); } - if (user != null) { - if (userId == null) { - userId = user.getId(); - } - } TraceContext traceContext = new TraceContext( traceId, diff --git a/sentry/src/main/java/io/sentry/TransactionContext.java b/sentry/src/main/java/io/sentry/TransactionContext.java index d81aa1059d..287fcee1fa 100644 --- a/sentry/src/main/java/io/sentry/TransactionContext.java +++ b/sentry/src/main/java/io/sentry/TransactionContext.java @@ -3,7 +3,6 @@ import io.sentry.protocol.SentryId; import io.sentry.protocol.TransactionNameSource; import io.sentry.util.Objects; -import java.util.List; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -18,40 +17,6 @@ public final class TransactionContext extends SpanContext { private @Nullable TracesSamplingDecision parentSamplingDecision; private boolean isForNextAppStart = false; - /** - * Creates {@link TransactionContext} from sentry-trace header. - * - * @param name - the transaction name - * @param operation - the operation - * @param sentryTrace - the sentry-trace header - * @deprecated use {@link Sentry#continueTrace(String, List)} and setters for name and operation - * here instead. - * @return the transaction contexts - */ - @Deprecated - public static @NotNull TransactionContext fromSentryTrace( - final @NotNull String name, - final @NotNull String operation, - final @NotNull SentryTraceHeader sentryTrace) { - @Nullable Boolean parentSampled = sentryTrace.isSampled(); - TracesSamplingDecision samplingDecision = - parentSampled == null ? null : new TracesSamplingDecision(parentSampled); - - TransactionContext transactionContext = - new TransactionContext( - sentryTrace.getTraceId(), - new SpanId(), - sentryTrace.getSpanId(), - samplingDecision, - null); - - transactionContext.setName(name); - transactionContext.setTransactionNameSource(TransactionNameSource.CUSTOM); - transactionContext.setOperation(operation); - - return transactionContext; - } - @ApiStatus.Internal public static TransactionContext fromPropagationContext( final @NotNull PropagationContext propagationContext) { diff --git a/sentry/src/main/java/io/sentry/protocol/Device.java b/sentry/src/main/java/io/sentry/protocol/Device.java index 25cfa41fd1..02bb39f25b 100644 --- a/sentry/src/main/java/io/sentry/protocol/Device.java +++ b/sentry/src/main/java/io/sentry/protocol/Device.java @@ -103,14 +103,6 @@ public final class Device implements JsonUnknown, JsonSerializable { private @Nullable String id; - /** - * This method returns the language code for this locale, which will either be the empty string or - * a lowercase ISO 639 code. - * - * @deprecated use {@link Device#getLocale()} - */ - @Deprecated private @Nullable String language; - /** The locale of the device. For example, en-US. */ private @Nullable String locale; @@ -162,7 +154,6 @@ public Device() {} this.screenDpi = device.screenDpi; this.bootTime = device.bootTime; this.id = device.id; - this.language = device.language; this.connectionType = device.connectionType; this.batteryTemperature = device.batteryTemperature; this.batteryLevel = device.batteryLevel; @@ -398,14 +389,6 @@ public void setId(final @Nullable String id) { this.id = id; } - public @Nullable String getLanguage() { - return language; - } - - public void setLanguage(final @Nullable String language) { - this.language = language; - } - public @Nullable String getConnectionType() { return connectionType; } @@ -477,7 +460,6 @@ public boolean equals(Object o) { && Objects.equals(screenDpi, device.screenDpi) && Objects.equals(bootTime, device.bootTime) && Objects.equals(id, device.id) - && Objects.equals(language, device.language) && Objects.equals(locale, device.locale) && Objects.equals(connectionType, device.connectionType) && Objects.equals(batteryTemperature, device.batteryTemperature) @@ -516,7 +498,6 @@ public int hashCode() { bootTime, timezone, id, - language, locale, connectionType, batteryTemperature, @@ -580,7 +561,6 @@ public static final class JsonKeys { public static final String BOOT_TIME = "boot_time"; public static final String TIMEZONE = "timezone"; public static final String ID = "id"; - public static final String LANGUAGE = "language"; public static final String CONNECTION_TYPE = "connection_type"; public static final String BATTERY_TEMPERATURE = "battery_temperature"; public static final String LOCALE = "locale"; @@ -674,9 +654,6 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger if (id != null) { writer.name(JsonKeys.ID).value(id); } - if (language != null) { - writer.name(JsonKeys.LANGUAGE).value(language); - } if (connectionType != null) { writer.name(JsonKeys.CONNECTION_TYPE).value(connectionType); } @@ -822,9 +799,6 @@ public static final class Deserializer implements JsonDeserializer { case JsonKeys.ID: device.id = reader.nextStringOrNull(); break; - case JsonKeys.LANGUAGE: - device.language = reader.nextStringOrNull(); - break; case JsonKeys.CONNECTION_TYPE: device.connectionType = reader.nextStringOrNull(); break; diff --git a/sentry/src/main/java/io/sentry/protocol/SdkVersion.java b/sentry/src/main/java/io/sentry/protocol/SdkVersion.java index aa997910be..50af4f6a4b 100644 --- a/sentry/src/main/java/io/sentry/protocol/SdkVersion.java +++ b/sentry/src/main/java/io/sentry/protocol/SdkVersion.java @@ -16,7 +16,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -98,40 +97,12 @@ public void addIntegration(final @NotNull String integration) { SentryIntegrationPackageStorage.getInstance().addIntegration(integration); } - /** - * Gets installed Sentry packages as list - * - * @deprecated use {@link SdkVersion#getPackageSet()} ()} - */ - @Deprecated - public @Nullable List getPackages() { - final Set packages = - deserializedPackages != null - ? deserializedPackages - : SentryIntegrationPackageStorage.getInstance().getPackages(); - return new CopyOnWriteArrayList<>(packages); - } - public @NotNull Set getPackageSet() { return deserializedPackages != null ? deserializedPackages : SentryIntegrationPackageStorage.getInstance().getPackages(); } - /** - * Gets installed Sentry integration names as list - * - * @deprecated use {@link SdkVersion#getIntegrationSet()} - */ - @Deprecated - public @Nullable List getIntegrations() { - final Set integrations = - deserializedIntegrations != null - ? deserializedIntegrations - : SentryIntegrationPackageStorage.getInstance().getIntegrations(); - return new CopyOnWriteArrayList<>(integrations); - } - public @NotNull Set getIntegrationSet() { return deserializedIntegrations != null ? deserializedIntegrations diff --git a/sentry/src/main/java/io/sentry/protocol/User.java b/sentry/src/main/java/io/sentry/protocol/User.java index ac9c28a934..e19525eefc 100644 --- a/sentry/src/main/java/io/sentry/protocol/User.java +++ b/sentry/src/main/java/io/sentry/protocol/User.java @@ -43,10 +43,7 @@ public final class User implements JsonUnknown, JsonSerializable { /** User geo location. */ private @Nullable Geo geo; - /** - * Additional arbitrary fields, as stored in the database (and sometimes as sent by clients). All - * data from `self.other` should end up here after store normalization. - */ + /** Additional arbitrary fields, as stored in the database (and sometimes as sent by clients). */ private @Nullable Map data; /** unknown fields, only internal usage. */ @@ -130,24 +127,6 @@ public static User fromMap(@NotNull Map map, @NotNull SentryOpti user.data = userData; } break; - case JsonKeys.OTHER: - final Map other = - (value instanceof Map) ? (Map) value : null; - // restore `other` from legacy JSON - if (other != null && (user.data == null || user.data.isEmpty())) { - final ConcurrentHashMap userData = new ConcurrentHashMap<>(); - for (Map.Entry otherEntry : other.entrySet()) { - if (otherEntry.getKey() instanceof String && otherEntry.getValue() != null) { - userData.put((String) otherEntry.getKey(), otherEntry.getValue().toString()); - } else { - options - .getLogger() - .log(SentryLevel.WARNING, "Invalid key or null value in other map."); - } - } - user.data = userData; - } - break; default: if (unknown == null) { unknown = new ConcurrentHashMap<>(); @@ -232,30 +211,6 @@ public void setIpAddress(final @Nullable String ipAddress) { this.ipAddress = ipAddress; } - /** - * Gets other user related data. - * - * @deprecated use {{@link User#getData()}} instead - * @return the other user data. - */ - @Deprecated - @SuppressWarnings("InlineMeSuggester") - public @Nullable Map getOthers() { - return getData(); - } - - /** - * Sets other user related data. - * - * @deprecated use {{@link User#setData(Map)}} instead - * @param other the other user related data. - */ - @Deprecated - @SuppressWarnings("InlineMeSuggester") - public void setOthers(final @Nullable Map other) { - this.setData(other); - } - /** * Get human readable name. * @@ -346,7 +301,6 @@ public static final class JsonKeys { public static final String IP_ADDRESS = "ip_address"; public static final String NAME = "name"; public static final String GEO = "geo"; - public static final String OTHER = "other"; public static final String DATA = "data"; } @@ -420,14 +374,6 @@ public static final class Deserializer implements JsonDeserializer { CollectionUtils.newConcurrentHashMap( (Map) reader.nextObjectOrNull()); break; - case JsonKeys.OTHER: - // restore `other` from legacy JSON - if (user.data == null || user.data.isEmpty()) { - user.data = - CollectionUtils.newConcurrentHashMap( - (Map) reader.nextObjectOrNull()); - } - break; default: if (unknown == null) { unknown = new ConcurrentHashMap<>(); diff --git a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt index 4f460bd408..a7d11e6660 100644 --- a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt @@ -249,30 +249,6 @@ class SentryOptionsTest { assertFailsWith { SentryOptions().profilesSampleRate = -0.0000000000001 } } - @Test - fun `when profilingEnabled is set to true, profilesSampleRate is set to 1`() { - val options = SentryOptions() - options.isProfilingEnabled = true - assertEquals(1.0, options.profilesSampleRate) - } - - @Test - fun `when profilingEnabled is set to false, profilesSampleRate is set to null`() { - val options = SentryOptions() - options.isProfilingEnabled = false - assertNull(options.profilesSampleRate) - } - - @Test - fun `when profilesSampleRate is set, setting profilingEnabled is ignored`() { - val options = SentryOptions() - options.profilesSampleRate = 0.2 - options.isProfilingEnabled = true - assertEquals(0.2, options.profilesSampleRate) - options.isProfilingEnabled = false - assertEquals(0.2, options.profilesSampleRate) - } - @Test fun `when options is initialized, transactionPerformanceCollector is set`() { assertIs(SentryOptions().transactionPerformanceCollector) diff --git a/sentry/src/test/java/io/sentry/TraceContextSerializationTest.kt b/sentry/src/test/java/io/sentry/TraceContextSerializationTest.kt index fee4a97984..8b00df543d 100644 --- a/sentry/src/test/java/io/sentry/TraceContextSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/TraceContextSerializationTest.kt @@ -72,15 +72,6 @@ class TraceContextSerializationTest { return baggage.toTraceContext()!! } - @Test - fun `can still parse legacy JSON with non flat user`() { - val expectedJson = sanitizedFile("json/trace_state_no_sample_rate.json") - val legacyJson = sanitizedFile("json/trace_state_legacy.json") - val actual = deserialize(legacyJson) - val actualJson = serialize(actual) - assertEquals(expectedJson, actualJson) - } - // Helper private fun sanitizedFile(path: String): String { diff --git a/sentry/src/test/java/io/sentry/TransactionContextTest.kt b/sentry/src/test/java/io/sentry/TransactionContextTest.kt index b1f324f06f..d6b715bd84 100644 --- a/sentry/src/test/java/io/sentry/TransactionContextTest.kt +++ b/sentry/src/test/java/io/sentry/TransactionContextTest.kt @@ -21,16 +21,6 @@ class TransactionContextTest { assertFalse(context.isForNextAppStart) } - @Test - fun `when context is created from trace header, parent sampling decision is set`() { - val header = SentryTraceHeader(SentryId(), SpanId(), true) - val context = TransactionContext.fromSentryTrace("name", "op", header) - assertNull(context.sampled) - assertNull(context.profileSampled) - assertTrue(context.parentSampled!!) - assertFalse(context.isForNextAppStart) - } - @Test fun `when context is created from propagation context, parent sampling decision of false is set from trace header`() { val logger = mock() diff --git a/sentry/src/test/java/io/sentry/protocol/DeviceSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/DeviceSerializationTest.kt index d09bed0643..8081ad5db9 100644 --- a/sentry/src/test/java/io/sentry/protocol/DeviceSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/DeviceSerializationTest.kt @@ -53,7 +53,6 @@ class DeviceSerializationTest { bootTime = DateUtils.getDateTime("2004-11-04T08:38:00.000Z") timezone = TimeZone.getTimeZone("Europe/Vienna") id = "e0fa5c8d-83f5-4e70-bc60-1e82ad30e196" - language = "6dd45f60-111d-42d8-9204-0452cc836ad8" connectionType = "9ceb3a6c-5292-4ed9-8665-5732495e8ed4" batteryTemperature = 0.14775127f cpuDescription = "cpu0" diff --git a/sentry/src/test/java/io/sentry/protocol/DeviceTest.kt b/sentry/src/test/java/io/sentry/protocol/DeviceTest.kt index 912f0d998f..679bca941b 100644 --- a/sentry/src/test/java/io/sentry/protocol/DeviceTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/DeviceTest.kt @@ -58,7 +58,6 @@ class DeviceTest { device.bootTime = Date() device.timezone = TimeZone.getDefault() device.id = "id" - device.language = "language" device.connectionType = "connection type" device.batteryTemperature = 30f device.locale = "en-US" @@ -99,7 +98,6 @@ class DeviceTest { assertEquals(1.5f, clone.screenDensity) assertEquals(300, clone.screenDpi) assertEquals("id", clone.id) - assertEquals("language", clone.language) assertEquals("connection type", clone.connectionType) assertEquals(30f, clone.batteryTemperature) assertEquals("cpu0", clone.cpuDescription) diff --git a/sentry/src/test/java/io/sentry/protocol/UserSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/UserSerializationTest.kt index 55c3648f43..cbe44e70f3 100644 --- a/sentry/src/test/java/io/sentry/protocol/UserSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/UserSerializationTest.kt @@ -29,7 +29,7 @@ class UserSerializationTest { countryCode = "JP" region = "273a3d0a-b1c5-11ed-afa1-0242ac120002" } - others = mapOf( + data = mapOf( "dc2813d0-0f66-4a3f-a995-71268f61a8fa" to "991659ad-7c59-4dd3-bb89-0bd5c74014bd" ) } @@ -51,23 +51,6 @@ class UserSerializationTest { assertEquals(expectedJson, actualJson) } - @Test - fun `deserialize legacy`() { - var expectedJson = sanitizedFile("json/user.json") - val expected = deserialize(expectedJson) - - // Not part of this test - expected.name = null - expected.geo = null - - expectedJson = serialize(expected) - - val inputJson = sanitizedFile("json/user_legacy.json") - val actual = deserialize(inputJson) - val actualJson = serialize(actual) - assertEquals(expectedJson, actualJson) - } - @Test fun deserializeFromMap() { val map: Map = mapOf( diff --git a/sentry/src/test/resources/json/contexts.json b/sentry/src/test/resources/json/contexts.json index 574bb01921..2bf48a60c1 100644 --- a/sentry/src/test/resources/json/contexts.json +++ b/sentry/src/test/resources/json/contexts.json @@ -59,7 +59,6 @@ "boot_time": "2004-11-04T08:38:00.000Z", "timezone": "Europe/Vienna", "id": "e0fa5c8d-83f5-4e70-bc60-1e82ad30e196", - "language": "6dd45f60-111d-42d8-9204-0452cc836ad8", "connection_type": "9ceb3a6c-5292-4ed9-8665-5732495e8ed4", "battery_temperature": 0.14775127, "processor_count": 4, diff --git a/sentry/src/test/resources/json/device.json b/sentry/src/test/resources/json/device.json index be4aabf38c..a82f864ee2 100644 --- a/sentry/src/test/resources/json/device.json +++ b/sentry/src/test/resources/json/device.json @@ -34,7 +34,6 @@ "boot_time": "2004-11-04T08:38:00.000Z", "timezone": "Europe/Vienna", "id": "e0fa5c8d-83f5-4e70-bc60-1e82ad30e196", - "language": "6dd45f60-111d-42d8-9204-0452cc836ad8", "connection_type": "9ceb3a6c-5292-4ed9-8665-5732495e8ed4", "battery_temperature": 0.14775127, "processor_count": 4, diff --git a/sentry/src/test/resources/json/sentry_base_event.json b/sentry/src/test/resources/json/sentry_base_event.json index afaf040863..fad001fa59 100644 --- a/sentry/src/test/resources/json/sentry_base_event.json +++ b/sentry/src/test/resources/json/sentry_base_event.json @@ -62,7 +62,6 @@ "boot_time": "2004-11-04T08:38:00.000Z", "timezone": "Europe/Vienna", "id": "e0fa5c8d-83f5-4e70-bc60-1e82ad30e196", - "language": "6dd45f60-111d-42d8-9204-0452cc836ad8", "connection_type": "9ceb3a6c-5292-4ed9-8665-5732495e8ed4", "battery_temperature": 0.14775127, "processor_count": 4, diff --git a/sentry/src/test/resources/json/sentry_base_event_with_null_extra.json b/sentry/src/test/resources/json/sentry_base_event_with_null_extra.json index 018cc7aae7..74fbe8779e 100644 --- a/sentry/src/test/resources/json/sentry_base_event_with_null_extra.json +++ b/sentry/src/test/resources/json/sentry_base_event_with_null_extra.json @@ -62,7 +62,6 @@ "boot_time": "2004-11-04T08:38:00.000Z", "timezone": "Europe/Vienna", "id": "e0fa5c8d-83f5-4e70-bc60-1e82ad30e196", - "language": "6dd45f60-111d-42d8-9204-0452cc836ad8", "connection_type": "9ceb3a6c-5292-4ed9-8665-5732495e8ed4", "battery_temperature": 0.14775127, "processor_count": 4, diff --git a/sentry/src/test/resources/json/sentry_event.json b/sentry/src/test/resources/json/sentry_event.json index 6d0b351ed4..4e260e0d45 100644 --- a/sentry/src/test/resources/json/sentry_event.json +++ b/sentry/src/test/resources/json/sentry_event.json @@ -197,7 +197,6 @@ "boot_time": "2004-11-04T08:38:00.000Z", "timezone": "Europe/Vienna", "id": "e0fa5c8d-83f5-4e70-bc60-1e82ad30e196", - "language": "6dd45f60-111d-42d8-9204-0452cc836ad8", "connection_type": "9ceb3a6c-5292-4ed9-8665-5732495e8ed4", "battery_temperature": 0.14775127, "processor_count": 4, diff --git a/sentry/src/test/resources/json/sentry_replay_event.json b/sentry/src/test/resources/json/sentry_replay_event.json index f026c9fee4..3849ad8f09 100644 --- a/sentry/src/test/resources/json/sentry_replay_event.json +++ b/sentry/src/test/resources/json/sentry_replay_event.json @@ -80,7 +80,6 @@ "boot_time": "2004-11-04T08:38:00.000Z", "timezone": "Europe/Vienna", "id": "e0fa5c8d-83f5-4e70-bc60-1e82ad30e196", - "language": "6dd45f60-111d-42d8-9204-0452cc836ad8", "connection_type": "9ceb3a6c-5292-4ed9-8665-5732495e8ed4", "battery_temperature": 0.14775127, "processor_count": 4, diff --git a/sentry/src/test/resources/json/sentry_transaction.json b/sentry/src/test/resources/json/sentry_transaction.json index 531122b349..d570555e44 100644 --- a/sentry/src/test/resources/json/sentry_transaction.json +++ b/sentry/src/test/resources/json/sentry_transaction.json @@ -119,7 +119,6 @@ "boot_time": "2004-11-04T08:38:00.000Z", "timezone": "Europe/Vienna", "id": "e0fa5c8d-83f5-4e70-bc60-1e82ad30e196", - "language": "6dd45f60-111d-42d8-9204-0452cc836ad8", "connection_type": "9ceb3a6c-5292-4ed9-8665-5732495e8ed4", "battery_temperature": 0.14775127, "processor_count": 4, diff --git a/sentry/src/test/resources/json/sentry_transaction_legacy_date_format.json b/sentry/src/test/resources/json/sentry_transaction_legacy_date_format.json index cfe39f706c..09100e5c8b 100644 --- a/sentry/src/test/resources/json/sentry_transaction_legacy_date_format.json +++ b/sentry/src/test/resources/json/sentry_transaction_legacy_date_format.json @@ -119,7 +119,6 @@ "boot_time": "2004-11-04T08:38:00.000Z", "timezone": "Europe/Vienna", "id": "e0fa5c8d-83f5-4e70-bc60-1e82ad30e196", - "language": "6dd45f60-111d-42d8-9204-0452cc836ad8", "connection_type": "9ceb3a6c-5292-4ed9-8665-5732495e8ed4", "battery_temperature": 0.14775127, "processor_count": 4, diff --git a/sentry/src/test/resources/json/sentry_transaction_no_measurement_unit.json b/sentry/src/test/resources/json/sentry_transaction_no_measurement_unit.json index 48588534ae..f9774cf6e5 100644 --- a/sentry/src/test/resources/json/sentry_transaction_no_measurement_unit.json +++ b/sentry/src/test/resources/json/sentry_transaction_no_measurement_unit.json @@ -107,7 +107,6 @@ "boot_time": "2004-11-04T08:38:00.000Z", "timezone": "Europe/Vienna", "id": "e0fa5c8d-83f5-4e70-bc60-1e82ad30e196", - "language": "6dd45f60-111d-42d8-9204-0452cc836ad8", "connection_type": "9ceb3a6c-5292-4ed9-8665-5732495e8ed4", "battery_temperature": 0.14775127 }, diff --git a/sentry/src/test/resources/json/trace_state_legacy.json b/sentry/src/test/resources/json/trace_state_legacy.json deleted file mode 100644 index 14f4f904a6..0000000000 --- a/sentry/src/test/resources/json/trace_state_legacy.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "trace_id": "65bcd18546c942069ed957b15b4ace7c", - "public_key": "5d593cac-f833-4845-bb23-4eabdf720da2", - "release": "9ee2c92c-401e-4296-b6f0-fb3b13edd9ee", - "environment": "0666ab02-6364-4135-aa59-02e8128ce052", - "user": - { - "id": "c052c566-6619-45f5-a61f-172802afa39a", - "segment": "f7d8662b-5551-4ef8-b6a8-090f0561a530" - }, - "transaction": "0252ec25-cd0a-4230-bd2f-936a4585637e" -} diff --git a/sentry/src/test/resources/json/user_legacy.json b/sentry/src/test/resources/json/user_legacy.json deleted file mode 100644 index f28a659494..0000000000 --- a/sentry/src/test/resources/json/user_legacy.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "email": "c4d61c1b-c144-431e-868f-37a46be5e5f2", - "id": "efb2084b-1871-4b59-8897-b4bd9f196a01", - "username": "60c05dff-7140-4d94-9a61-c9cdd9ca9b96", - "ip_address": "51d22b77-f663-4dbe-8103-8b749d1d9a48", - "other": - { - "dc2813d0-0f66-4a3f-a995-71268f61a8fa": "991659ad-7c59-4dd3-bb89-0bd5c74014bd" - } -}