Skip to content

Commit e9df1c2

Browse files
committed
Merge branch 'feat/data-collection-options' into feat/data-collection-resolver
2 parents 9bce9f3 + 619bee6 commit e9df1c2

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎sentry/src/main/java/io/sentry/DataCollection.java‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
/** Configures data that the SDK collects automatically. */
1111
public final class DataCollection {
1212

13-
private boolean overridden;
13+
// Forces Data Collection to be used even when no individual option has been configured.
14+
private boolean forceDataCollection;
1415
private @Nullable Boolean userInfo;
1516
private @Nullable KeyValueCollectionBehavior cookies;
1617
private @Nullable KeyValueCollectionBehavior urlQueryParams;
@@ -23,8 +24,8 @@ public DataCollection() {
2324
this(true);
2425
}
2526

26-
DataCollection(final boolean overridden) {
27-
this.overridden = overridden;
27+
DataCollection(final boolean forceDataCollection) {
28+
this.forceDataCollection = forceDataCollection;
2829
}
2930

3031
public @Nullable Boolean getUserInfo() {
@@ -82,7 +83,7 @@ public void setDatabaseQueryData(final boolean databaseQueryData) {
8283

8384
@ApiStatus.Internal
8485
boolean isExplicitlyConfigured() {
85-
return overridden
86+
return forceDataCollection
8687
|| userInfo != null
8788
|| cookies != null
8889
|| urlQueryParams != null

‎sentry/src/test/java/io/sentry/DataCollectionTest.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import kotlin.test.assertFailsWith
66

77
class DataCollectionTest {
88
@Test
9-
fun `public constructor creates explicit empty configuration`() {
9+
fun `public constructor forces Data Collection for empty configuration`() {
1010
val dataCollection = DataCollection()
1111

1212
assertThat(dataCollection.userInfo).isNull()
@@ -22,7 +22,7 @@ class DataCollectionTest {
2222
}
2323

2424
@Test
25-
fun `SDK-owned configuration starts unconfigured`() {
25+
fun `SDK-owned configuration does not force Data Collection`() {
2626
val dataCollection = DataCollection(false)
2727

2828
assertThat(dataCollection.isExplicitlyConfigured()).isFalse()

0 commit comments

Comments
 (0)