Skip to content

Commit

Permalink
Remove deprecations (#3780)
Browse files Browse the repository at this point in the history
* attach request body for application/x-www-form-urlencoded

* extend tests

* changelog

* Add support for v22 of graphql-java, new modules sentry-graphql-22 and sentry-graphql-core

* Add back callback interface and constants as deprecated

* Replace GraphQlSourceBuilderCustomizer with directly providing a SentryInstrumentation bean if missing

* Support graphql-java v22 in spring integrations

* Close scopes before replacing options on global scope

* changelog

* fix api file

* remove metrics

* remove enableTracing

* remove deprecations

* remove user other legacy handling code

* changelog
  • Loading branch information
adinauer authored Oct 10, 2024
1 parent 93ee8ee commit 1eb8476
Show file tree
Hide file tree
Showing 41 changed files with 37 additions and 734 deletions.
18 changes: 15 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions sentry-android-core/api/sentry-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -334,15 +322,7 @@ static void applyMetadata(
List<String> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions sentry-graphql-core/api/sentry-graphql-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -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 <init> (Lgraphql/execution/DataFetcherExceptionHandler;)V
public fun <init> (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 <init> (Lgraphql/execution/DataFetcherExceptionHandler;)V
public fun <init> (Lio/sentry/IScopes;Lgraphql/execution/DataFetcherExceptionHandler;)V
Expand Down
Loading

0 comments on commit 1eb8476

Please sign in to comment.