Skip to content

Commit d45fe8e

Browse files
committed
chore(stack): Merge preceding stack changes
2 parents 020d5b8 + 58989ab commit d45fe8e

14 files changed

Lines changed: 4 additions & 877 deletions

File tree

‎sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java‎

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,10 @@ final class ManifestMetadataReader {
192192

193193
static final String IN_APP_EXCLUDES = "io.sentry.in-app-excludes";
194194

195-
static final String ENABLE_LOGS = "io.sentry.logs.enabled";
196-
197195
static final String ENABLE_TIMBER_LOGS = "io.sentry.timber.logs.enabled";
198196

199197
static final String ENABLE_LOGCAT_LOGS = "io.sentry.logcat.logs.enabled";
200198

201-
static final String ENABLE_METRICS = "io.sentry.metrics.enabled";
202-
203199
static final String ENABLE_AUTO_TRACE_ID_GENERATION =
204200
"io.sentry.traces.enable-auto-id-generation";
205201

@@ -754,38 +750,6 @@ static void applyMetadata(
754750
}
755751
}
756752

757-
if (containsKey(metadata, ENABLE_LOGS)) {
758-
final boolean enableLogs = readBool(metadata, logger, ENABLE_LOGS, false);
759-
if (enableLogs) {
760-
logger.log(
761-
SentryLevel.WARNING,
762-
"The Android manifest option 'io.sentry.logs.enabled' is no longer supported. "
763-
+ "Manual Sentry.logger() calls no longer require it, and automatic logging "
764-
+ "integrations now require their own opt-ins.");
765-
} else {
766-
logger.log(
767-
SentryLevel.WARNING,
768-
"The Android manifest option 'io.sentry.logs.enabled' no longer disables manual "
769-
+ "Sentry.logger() calls. Automatic logging integrations remain disabled "
770-
+ "unless enabled through their own opt-ins.");
771-
}
772-
}
773-
774-
if (containsKey(metadata, ENABLE_METRICS)) {
775-
final boolean enableMetrics = readBool(metadata, logger, ENABLE_METRICS, false);
776-
if (enableMetrics) {
777-
logger.log(
778-
SentryLevel.WARNING,
779-
"The Android manifest option 'io.sentry.metrics.enabled' is no longer supported. "
780-
+ "Manual Sentry.metrics() calls no longer require it.");
781-
} else {
782-
logger.log(
783-
SentryLevel.WARNING,
784-
"The Android manifest option 'io.sentry.metrics.enabled' no longer disables "
785-
+ "manual Sentry.metrics() calls.");
786-
}
787-
}
788-
789753
options.setEnableTimberLogs(
790754
readBool(metadata, logger, ENABLE_TIMBER_LOGS, options.isEnableTimberLogs()));
791755

‎sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt‎

Lines changed: 1 addition & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import io.sentry.ProfileLifecycle
1313
import io.sentry.SentryLevel
1414
import io.sentry.SentryReplayOptions
1515
import io.sentry.TransactionOptions
16-
import io.sentry.test.createSentryClientMock
17-
import io.sentry.test.createTestScopes
1816
import kotlin.test.AfterTest
1917
import kotlin.test.BeforeTest
2018
import kotlin.test.Test
@@ -25,7 +23,6 @@ import kotlin.test.assertNull
2523
import kotlin.test.assertTrue
2624
import org.junit.runner.RunWith
2725
import org.mockito.kotlin.any
28-
import org.mockito.kotlin.anyOrNull
2926
import org.mockito.kotlin.eq
3027
import org.mockito.kotlin.mock
3128
import org.mockito.kotlin.never
@@ -36,7 +33,7 @@ import org.mockito.kotlin.verifyNoInteractions
3633
class ManifestMetadataReaderTest {
3734
private class Fixture {
3835
val logger = mock<ILogger>()
39-
val options = SentryAndroidOptions().apply { setLogger(this@Fixture.logger) }
36+
val options = SentryAndroidOptions().apply { setLogger(logger) }
4037
val buildInfoProvider = mock<BuildInfoProvider>()
4138

4239
fun getContext(metaData: Bundle = Bundle()): Context =
@@ -2178,64 +2175,6 @@ class ManifestMetadataReaderTest {
21782175
assertTrue(fixture.options.inAppExcludes.isEmpty())
21792176
}
21802177

2181-
@Test
2182-
fun `applyMetadata does not warn when legacy logs enabled metadata is absent`() {
2183-
fixture.options.isDebug = true
2184-
val context = fixture.getContext()
2185-
2186-
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
2187-
2188-
verify(fixture.logger, never()).log(eq(SentryLevel.WARNING), any<String>())
2189-
}
2190-
2191-
@Test
2192-
fun `applyMetadata warns when legacy logs enabled metadata is true`() {
2193-
val bundle =
2194-
bundleOf(
2195-
ManifestMetadataReader.DEBUG to true,
2196-
ManifestMetadataReader.ENABLE_LOGS to true,
2197-
)
2198-
val context = fixture.getContext(metaData = bundle)
2199-
2200-
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
2201-
2202-
verify(fixture.logger)
2203-
.log(
2204-
SentryLevel.WARNING,
2205-
"The Android manifest option 'io.sentry.logs.enabled' is no longer supported. " +
2206-
"Manual Sentry.logger() calls no longer require it, and automatic logging " +
2207-
"integrations now require their own opt-ins.",
2208-
*emptyArray(),
2209-
)
2210-
assertThat(fixture.options.isEnableTimberLogs).isFalse()
2211-
assertThat(fixture.options.isEnableLogcatLogs).isFalse()
2212-
}
2213-
2214-
@Test
2215-
fun `applyMetadata warns when legacy logs enabled metadata is false`() {
2216-
fixture.options.isEnableTimberLogs = true
2217-
fixture.options.isEnableLogcatLogs = true
2218-
val bundle =
2219-
bundleOf(
2220-
ManifestMetadataReader.DEBUG to true,
2221-
ManifestMetadataReader.ENABLE_LOGS to false,
2222-
)
2223-
val context = fixture.getContext(metaData = bundle)
2224-
2225-
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
2226-
2227-
verify(fixture.logger)
2228-
.log(
2229-
SentryLevel.WARNING,
2230-
"The Android manifest option 'io.sentry.logs.enabled' no longer disables manual " +
2231-
"Sentry.logger() calls. Automatic logging integrations remain disabled unless " +
2232-
"enabled through their own opt-ins.",
2233-
*emptyArray(),
2234-
)
2235-
assertThat(fixture.options.isEnableTimberLogs).isTrue()
2236-
assertThat(fixture.options.isEnableLogcatLogs).isTrue()
2237-
}
2238-
22392178
@Test
22402179
fun `applyMetadata keeps Timber logs disabled if not found`() {
22412180
val context = fixture.getContext()
@@ -2285,66 +2224,6 @@ class ManifestMetadataReaderTest {
22852224
assertThat(fixture.options.isEnableLogcatLogs).isFalse()
22862225
}
22872226

2288-
@Test
2289-
fun `applyMetadata does not warn when legacy metrics enabled metadata is absent`() {
2290-
fixture.options.isDebug = true
2291-
val context = fixture.getContext()
2292-
2293-
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
2294-
2295-
verify(fixture.logger, never()).log(eq(SentryLevel.WARNING), any<String>())
2296-
}
2297-
2298-
@Test
2299-
fun `applyMetadata warns when legacy metrics enabled metadata is true`() {
2300-
val bundle =
2301-
bundleOf(
2302-
ManifestMetadataReader.DEBUG to true,
2303-
ManifestMetadataReader.ENABLE_METRICS to true,
2304-
)
2305-
val context = fixture.getContext(metaData = bundle)
2306-
val client = createSentryClientMock()
2307-
2308-
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
2309-
fixture.options.dsn = "https://key@sentry.io/proj"
2310-
val scopes = createTestScopes(fixture.options).also { it.bindClient(client) }
2311-
scopes.metrics().count("metric name")
2312-
2313-
verify(fixture.logger)
2314-
.log(
2315-
SentryLevel.WARNING,
2316-
"The Android manifest option 'io.sentry.metrics.enabled' is no longer supported. " +
2317-
"Manual Sentry.metrics() calls no longer require it.",
2318-
*emptyArray(),
2319-
)
2320-
verify(client).captureMetric(any(), anyOrNull(), anyOrNull())
2321-
}
2322-
2323-
@Test
2324-
fun `applyMetadata warns when legacy metrics enabled metadata is false`() {
2325-
val bundle =
2326-
bundleOf(
2327-
ManifestMetadataReader.DEBUG to true,
2328-
ManifestMetadataReader.ENABLE_METRICS to false,
2329-
)
2330-
val context = fixture.getContext(metaData = bundle)
2331-
val client = createSentryClientMock()
2332-
2333-
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
2334-
fixture.options.dsn = "https://key@sentry.io/proj"
2335-
val scopes = createTestScopes(fixture.options).also { it.bindClient(client) }
2336-
scopes.metrics().count("metric name")
2337-
2338-
verify(fixture.logger)
2339-
.log(
2340-
SentryLevel.WARNING,
2341-
"The Android manifest option 'io.sentry.metrics.enabled' no longer disables manual " +
2342-
"Sentry.metrics() calls.",
2343-
*emptyArray(),
2344-
)
2345-
verify(client).captureMetric(any(), anyOrNull(), anyOrNull())
2346-
}
2347-
23482227
@Test
23492228
fun `applyMetadata reads feedback name required and keep default value if not found`() {
23502229
// Arrange

‎sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java‎

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import io.sentry.ScopesAdapter;
1212
import io.sentry.Sentry;
1313
import io.sentry.SentryIntegrationPackageStorage;
14-
import io.sentry.SentryLevel;
1514
import io.sentry.SentryOptions;
1615
import io.sentry.protocol.SdkVersion;
1716
import io.sentry.quartz.SentryJobListener;
@@ -164,8 +163,7 @@ static class OpenTelemetryNoAgentConfiguration {}
164163
final @NotNull List<Sentry.OptionsConfiguration<SentryOptions>> optionsConfigurations,
165164
final @NotNull SentryProperties options,
166165
final @NotNull ObjectProvider<ISpanFactory> spanFactory,
167-
final @NotNull ObjectProvider<GitProperties> gitProperties,
168-
final @NotNull Environment environment) {
166+
final @NotNull ObjectProvider<GitProperties> gitProperties) {
169167
optionsConfigurations.forEach(
170168
optionsConfiguration -> optionsConfiguration.configure(options));
171169
gitProperties.ifAvailable(
@@ -187,59 +185,9 @@ static class OpenTelemetryNoAgentConfiguration {}
187185
// here we make sure that only classes that extend throwable are set on this field
188186
options.getIgnoredExceptionsForType().removeIf(it -> !Throwable.class.isAssignableFrom(it));
189187
Sentry.init(options);
190-
warnForLegacyLogsConfiguration(environment, options);
191-
warnForLegacyMetricsConfiguration(environment, options);
192188
return ScopesAdapter.getInstance();
193189
}
194190

195-
private void warnForLegacyLogsConfiguration(
196-
final @NotNull Environment environment, final @NotNull SentryOptions options) {
197-
if (environment.containsProperty("sentry.logs.enabled")) {
198-
final boolean enableLogs =
199-
Boolean.TRUE.equals(environment.getProperty("sentry.logs.enabled", Boolean.class));
200-
if (enableLogs) {
201-
options
202-
.getLogger()
203-
.log(
204-
SentryLevel.WARNING,
205-
"The 'sentry.logs.enabled' property is no longer supported. Manual "
206-
+ "Sentry.logger() calls no longer require it, and automatic logging "
207-
+ "integrations now require their own opt-ins.");
208-
} else {
209-
options
210-
.getLogger()
211-
.log(
212-
SentryLevel.WARNING,
213-
"The 'sentry.logs.enabled' property no longer disables manual Sentry.logger() "
214-
+ "calls. Automatic logging integrations remain disabled unless enabled "
215-
+ "through their own opt-ins.");
216-
}
217-
}
218-
}
219-
220-
private void warnForLegacyMetricsConfiguration(
221-
final @NotNull Environment environment, final @NotNull SentryOptions options) {
222-
if (environment.containsProperty("sentry.metrics.enabled")) {
223-
final boolean enableMetrics =
224-
Boolean.TRUE.equals(environment.getProperty("sentry.metrics.enabled", Boolean.class));
225-
if (enableMetrics) {
226-
options
227-
.getLogger()
228-
.log(
229-
SentryLevel.WARNING,
230-
"The 'sentry.metrics.enabled' property is no longer supported. Manual "
231-
+ "Sentry.metrics() calls no longer require it.");
232-
} else {
233-
options
234-
.getLogger()
235-
.log(
236-
SentryLevel.WARNING,
237-
"The 'sentry.metrics.enabled' property no longer disables manual "
238-
+ "Sentry.metrics() calls.");
239-
}
240-
}
241-
}
242-
243191
@Configuration(proxyBeanMethods = false)
244192
@ConditionalOnClass(MDC.class)
245193
@Open

0 commit comments

Comments
 (0)