Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove enableTracing option in v8 #3776

Merged
merged 15 commits into from
Oct 10, 2024
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- Throw IllegalArgumentException when calling Sentry.init on Android ([#3596](https://github.com/getsentry/sentry-java/pull/3596))
- Metrics have been removed from the SDK ([#3774](https://github.com/getsentry/sentry-java/pull/3774))
- Metrics will return but we don't know in what exact form yet
- `enableTracing` option (a.k.a `enable-tracing`) has been removed from the SDK ([#3776](https://github.com/getsentry/sentry-java/pull/3776))
- Please set `tracesSampleRate` to a value >= 0.0 for enabling performance instead. The default value is `null` which means performance is disabled.
- Change OkHttp sub-spans to span attributes ([#3556](https://github.com/getsentry/sentry-java/pull/3556))
- This will reduce the number of spans created by the SDK
- `options.experimental.sessionReplay.errorSampleRate` was renamed to `options.experimental.sessionReplay.onErrorSampleRate` ([#3637](https://github.com/getsentry/sentry-java/pull/3637))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ final class ManifestMetadataReader {
static final String UNCAUGHT_EXCEPTION_HANDLER_ENABLE =
"io.sentry.uncaught-exception-handler.enable";

static final String TRACING_ENABLE = "io.sentry.traces.enable";
static final String TRACES_SAMPLE_RATE = "io.sentry.traces.sample-rate";
static final String TRACES_ACTIVITY_ENABLE = "io.sentry.traces.activity.enable";
static final String TRACES_ACTIVITY_AUTO_FINISH_ENABLE =
Expand Down Expand Up @@ -286,10 +285,6 @@ static void applyMetadata(
COLLECT_ADDITIONAL_CONTEXT,
options.isCollectAdditionalContext()));

if (options.getEnableTracing() == null) {
options.setEnableTracing(readBoolNullable(metadata, logger, TRACING_ENABLE, null));
}

if (options.getTracesSampleRate() == null) {
final Double tracesSampleRate = readDouble(metadata, logger, TRACES_SAMPLE_RATE);
if (tracesSampleRate != -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public final class SentryAndroidOptions extends SentryOptions {
* Enables the Auto instrumentation for Activity lifecycle tracing.
*
* <ul>
* <li>It also requires setting any of {@link SentryOptions#getEnableTracing()}, {@link
* SentryOptions#getTracesSampleRate()} or {@link SentryOptions#getTracesSampler()}.
* <li>It also requires setting any of {@link SentryOptions#getTracesSampleRate()} or {@link
* SentryOptions#getTracesSampler()}.
* </ul>
*
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ class ActivityLifecycleIntegrationTest {
fun `starts new trace if performance is disabled`() {
val sut = fixture.getSut()
val activity = mock<Activity>()
fixture.options.enableTracing = false
fixture.options.tracesSampleRate = null

val argumentCaptor: ArgumentCaptor<ScopeCallback> = ArgumentCaptor.forClass(ScopeCallback::class.java)
val scope = Scope(fixture.options)
Expand All @@ -1381,7 +1381,7 @@ class ActivityLifecycleIntegrationTest {
fun `sets the activity as the current screen`() {
val sut = fixture.getSut()
val activity = mock<Activity>()
fixture.options.enableTracing = false
fixture.options.tracesSampleRate = null

val argumentCaptor: ArgumentCaptor<ScopeCallback> = ArgumentCaptor.forClass(ScopeCallback::class.java)
val scope = mock<IScope>()
Expand All @@ -1401,7 +1401,7 @@ class ActivityLifecycleIntegrationTest {
fun `does not start another new trace if one has already been started but does after activity was destroyed`() {
val sut = fixture.getSut()
val activity = mock<Activity>()
fixture.options.enableTracing = false
fixture.options.tracesSampleRate = null

val argumentCaptor: ArgumentCaptor<ScopeCallback> = ArgumentCaptor.forClass(ScopeCallback::class.java)
val scope = Scope(fixture.options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,45 +672,6 @@ class ManifestMetadataReaderTest {
assertNull(fixture.options.tracesSampleRate)
}

@Test
fun `applyMetadata reads enableTracing from metadata`() {
// Arrange
val bundle = bundleOf(ManifestMetadataReader.TRACING_ENABLE to true)
val context = fixture.getContext(metaData = bundle)

// Act
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)

// Assert
assertEquals(true, fixture.options.enableTracing)
}

@Test
fun `applyMetadata does not override enableTracing from options`() {
// Arrange
fixture.options.enableTracing = true
val bundle = bundleOf(ManifestMetadataReader.TRACING_ENABLE to false)
val context = fixture.getContext(metaData = bundle)

// Act
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)

// Assert
assertEquals(true, fixture.options.enableTracing)
}

@Test
fun `applyMetadata without specifying enableTracing, stays null`() {
// Arrange
val context = fixture.getContext()

// Act
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)

// Assert
assertNull(fixture.options.enableTracing)
}

@Test
fun `applyMetadata reads enableAutoActivityLifecycleTracing to options`() {
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class SentryNavigationListenerTest {
toRoute: String? = "route",
toId: String? = "destination-id-1",
enableBreadcrumbs: Boolean = true,
enableTracing: Boolean = true,
enableNavigationTracing: Boolean = true,
enableScreenTracking: Boolean = true,
tracesSampleRate: Double? = 1.0,
hasViewIdInRes: Boolean = true,
Expand Down Expand Up @@ -100,7 +100,7 @@ class SentryNavigationListenerTest {
return SentryNavigationListener(
scopes,
enableBreadcrumbs,
enableTracing,
enableNavigationTracing,
traceOriginAppendix
)
}
Expand Down Expand Up @@ -203,7 +203,7 @@ class SentryNavigationListenerTest {

@Test
fun `onDestinationChanged does not start tracing when tracing is disabled`() {
val sut = fixture.getSut(enableTracing = false)
val sut = fixture.getSut(enableNavigationTracing = false)

sut.onDestinationChanged(fixture.navController, fixture.destination, null)

Expand All @@ -215,7 +215,7 @@ class SentryNavigationListenerTest {

@Test
fun `onDestinationChanged does not start tracing when tracesSampleRate is not set`() {
val sut = fixture.getSut(enableTracing = true, tracesSampleRate = null)
val sut = fixture.getSut(enableNavigationTracing = true, tracesSampleRate = null)

sut.onDestinationChanged(fixture.navController, fixture.destination, null)

Expand Down Expand Up @@ -361,7 +361,7 @@ class SentryNavigationListenerTest {

@Test
fun `starts new trace if performance is disabled`() {
val sut = fixture.getSut(enableTracing = false)
val sut = fixture.getSut(enableNavigationTracing = false)

val argumentCaptor: ArgumentCaptor<ScopeCallback> =
ArgumentCaptor.forClass(ScopeCallback::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ sentry.logging.minimum-event-level=info
sentry.logging.minimum-breadcrumb-level=debug
# Performance configuration
sentry.traces-sample-rate=1.0
sentry.enable-tracing=true
sentry.ignored-checkins=ignored_monitor_slug_1,ignored_monitor_slug_2
sentry.debug=true
sentry.graphql.ignored-error-types=SOME_ERROR,ANOTHER_ERROR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ sentry.max-breadcrumbs=150
sentry.logging.minimum-event-level=info
sentry.logging.minimum-breadcrumb-level=debug
sentry.reactive.thread-local-accessor-enabled=true
sentry.enable-tracing=true
sentry.traces-sample-rate=1.0
sentry.enable-backpressure-handling=true
sentry.enable-spotlight=true
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sentry.max-breadcrumbs=150
# Logback integration configuration options
sentry.logging.minimum-event-level=info
sentry.logging.minimum-breadcrumb-level=debug
sentry.enable-tracing=true
sentry.traces-sample-rate=1.0
spring.graphql.graphiql.enabled=true
spring.graphql.websocket.path=/graphql
spring.graphql.schema.printer.enabled=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ sentry.logging.minimum-event-level=info
sentry.logging.minimum-breadcrumb-level=debug
# Performance configuration
sentry.traces-sample-rate=1.0
sentry.enable-tracing=true
sentry.ignored-checkins=ignored_monitor_slug_1,ignored_monitor_slug_2
sentry.debug=true
sentry.graphql.ignored-error-types=SOME_ERROR,ANOTHER_ERROR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,6 @@ public SentryTracingCondition() {
super(ConfigurationPhase.REGISTER_BEAN);
}

@ConditionalOnProperty(name = "sentry.enable-tracing")
@SuppressWarnings("UnusedNestedClass")
private static class SentryEnableTracingCondition {}

@ConditionalOnProperty(name = "sentry.traces-sample-rate")
@SuppressWarnings("UnusedNestedClass")
private static class SentryTracesSampleRateCondition {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ class SentryAutoConfigurationTest {
"sentry.proxy.port=8090",
"sentry.proxy.user=proxy-user",
"sentry.proxy.pass=proxy-pass",
"sentry.enable-tracing=true",
"sentry.traces-sample-rate=0.3",
"sentry.tags.tag1=tag1-value",
"sentry.tags.tag2=tag2-value",
Expand Down Expand Up @@ -203,7 +202,6 @@ class SentryAutoConfigurationTest {
assertThat(options.proxy!!.port).isEqualTo("8090")
assertThat(options.proxy!!.user).isEqualTo("proxy-user")
assertThat(options.proxy!!.pass).isEqualTo("proxy-pass")
assertThat(options.enableTracing).isEqualTo(true)
assertThat(options.tracesSampleRate).isEqualTo(0.3)
assertThat(options.tags).containsEntry("tag1", "tag1-value").containsEntry("tag2", "tag2-value")
assertThat(options.ignoredExceptionsForType).containsOnly(RuntimeException::class.java, IllegalStateException::class.java)
Expand Down Expand Up @@ -478,14 +476,6 @@ class SentryAutoConfigurationTest {
}
}

@Test
fun `when enable tracing is set to false and traces sample rate is set, creates tracing filter`() {
contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=0.2")
.run {
assertThat(it).hasBean("sentryTracingFilter")
}
}

@Test
fun `when traces sample rate is set to 0, creates tracing filter`() {
contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,6 @@ public SentryTracingCondition() {
super(ConfigurationPhase.REGISTER_BEAN);
}

@ConditionalOnProperty(name = "sentry.enable-tracing")
@SuppressWarnings("UnusedNestedClass")
private static class SentryEnableTracingCondition {}

@ConditionalOnProperty(name = "sentry.traces-sample-rate")
@SuppressWarnings("UnusedNestedClass")
private static class SentryTracesSampleRateCondition {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ class SentryAutoConfigurationTest {
"sentry.proxy.port=8090",
"sentry.proxy.user=proxy-user",
"sentry.proxy.pass=proxy-pass",
"sentry.enable-tracing=true",
"sentry.traces-sample-rate=0.3",
"sentry.tags.tag1=tag1-value",
"sentry.tags.tag2=tag2-value",
Expand Down Expand Up @@ -202,7 +201,6 @@ class SentryAutoConfigurationTest {
assertThat(options.proxy!!.port).isEqualTo("8090")
assertThat(options.proxy!!.user).isEqualTo("proxy-user")
assertThat(options.proxy!!.pass).isEqualTo("proxy-pass")
assertThat(options.enableTracing).isEqualTo(true)
assertThat(options.tracesSampleRate).isEqualTo(0.3)
assertThat(options.tags).containsEntry("tag1", "tag1-value").containsEntry("tag2", "tag2-value")
assertThat(options.ignoredExceptionsForType).containsOnly(RuntimeException::class.java, IllegalStateException::class.java)
Expand Down Expand Up @@ -479,14 +477,6 @@ class SentryAutoConfigurationTest {
}
}

@Test
fun `when enable tracing is set to false and traces sample rate is set, creates tracing filter`() {
contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=0.2")
.run {
assertThat(it).hasBean("sentryTracingFilter")
}
}

@Test
fun `when traces sample rate is set to 0, creates tracing filter`() {
contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SentryTracingFilterTest {
val transactionNameProvider = mock<TransactionNameProvider>()
val options = SentryOptions().apply {
dsn = "https://[email protected]/proj"
enableTracing = true
tracesSampleRate = 1.0
}
val logger = mock<ILogger>()

Expand Down Expand Up @@ -268,7 +268,7 @@ class SentryTracingFilterTest {
val parentSpanId = SpanId()
val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1"
val baggageHeaderStrings = listOf("sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET")
fixture.options.enableTracing = false
fixture.options.tracesSampleRate = null
val filter = fixture.getSut(sentryTraceHeader = sentryTraceHeaderString, baggageHeaders = baggageHeaderStrings)

filter.doFilter(fixture.request, fixture.response, fixture.chain)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SentryWebFluxTracingFilterTest {
val chain = mock<WebFilterChain>()
val options = SentryOptions().apply {
dsn = "https://[email protected]/proj"
enableTracing = true
tracesSampleRate = 1.0
}
val logger = mock<ILogger>()

Expand Down Expand Up @@ -305,7 +305,7 @@ class SentryWebFluxTracingFilterTest {
val parentSpanId = SpanId()
val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1"
val baggageHeaderStrings = listOf("sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET")
fixture.options.enableTracing = false
fixture.options.tracesSampleRate = null
val filter = fixture.getSut(sentryTraceHeader = sentryTraceHeaderString, baggageHeaders = baggageHeaderStrings)

withMockScopes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ open class App {
it.dsn = "http://key@localhost/proj"
it.setDebug(true)
it.setTransportFactory(transportFactory)
it.enableTracing = true
it.tracesSampleRate = 1.0
it.isEnableBackpressureHandling = false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SentryTracingFilterTest {
val transactionNameProvider = mock<TransactionNameProvider>()
val options = SentryOptions().apply {
dsn = "https://[email protected]/proj"
enableTracing = true
tracesSampleRate = 1.0
}
val logger = mock<ILogger>()

Expand Down Expand Up @@ -268,7 +268,7 @@ class SentryTracingFilterTest {
val parentSpanId = SpanId()
val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1"
val baggageHeaderStrings = listOf("sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET")
fixture.options.enableTracing = false
fixture.options.tracesSampleRate = null
val filter = fixture.getSut(sentryTraceHeader = sentryTraceHeaderString, baggageHeaders = baggageHeaderStrings)

filter.doFilter(fixture.request, fixture.response, fixture.chain)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SentryWebFluxTracingFilterTest {
val chain = mock<WebFilterChain>()
val options = SentryOptions().apply {
dsn = "https://[email protected]/proj"
enableTracing = true
tracesSampleRate = 1.0
}
val logger = mock<ILogger>()

Expand Down Expand Up @@ -306,7 +306,7 @@ class SentryWebFluxTracingFilterTest {
val parentSpanId = SpanId()
val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1"
val baggageHeaderStrings = listOf("sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET")
fixture.options.enableTracing = false
fixture.options.tracesSampleRate = null
val filter = fixture.getSut(sentryTraceHeader = sentryTraceHeaderString, baggageHeaders = baggageHeaderStrings)

withMockScopes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ open class App {
it.dsn = "http://key@localhost/proj"
it.setDebug(true)
it.setTransportFactory(transportFactory)
it.enableTracing = true
it.tracesSampleRate = 1.0
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions sentry/api/sentry.api
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ public final class io/sentry/ExternalOptions {
public fun getDist ()Ljava/lang/String;
public fun getDsn ()Ljava/lang/String;
public fun getEnableDeduplication ()Ljava/lang/Boolean;
public fun getEnableTracing ()Ljava/lang/Boolean;
public fun getEnableUncaughtExceptionHandler ()Ljava/lang/Boolean;
public fun getEnvironment ()Ljava/lang/String;
public fun getIdleTimeout ()Ljava/lang/Long;
Expand Down Expand Up @@ -482,7 +481,6 @@ public final class io/sentry/ExternalOptions {
public fun setEnableDeduplication (Ljava/lang/Boolean;)V
public fun setEnablePrettySerializationOutput (Ljava/lang/Boolean;)V
public fun setEnableSpotlight (Ljava/lang/Boolean;)V
public fun setEnableTracing (Ljava/lang/Boolean;)V
public fun setEnableUncaughtExceptionHandler (Ljava/lang/Boolean;)V
public fun setEnabled (Ljava/lang/Boolean;)V
public fun setEnvironment (Ljava/lang/String;)V
Expand Down Expand Up @@ -2802,7 +2800,6 @@ public class io/sentry/SentryOptions {
public fun getDist ()Ljava/lang/String;
public fun getDistinctId ()Ljava/lang/String;
public fun getDsn ()Ljava/lang/String;
public fun getEnableTracing ()Ljava/lang/Boolean;
public fun getEnvelopeDiskCache ()Lio/sentry/cache/IEnvelopeCache;
public fun getEnvelopeReader ()Lio/sentry/IEnvelopeReader;
public fun getEnvironment ()Ljava/lang/String;
Expand Down Expand Up @@ -2928,7 +2925,6 @@ public class io/sentry/SentryOptions {
public fun setEnableShutdownHook (Z)V
public fun setEnableSpotlight (Z)V
public fun setEnableTimeToFullDisplayTracing (Z)V
public fun setEnableTracing (Ljava/lang/Boolean;)V
public fun setEnableUncaughtExceptionHandler (Z)V
public fun setEnableUserInteractionBreadcrumbs (Z)V
public fun setEnableUserInteractionTracing (Z)V
Expand Down
Loading
Loading