Skip to content

Commit

Permalink
Merge cf5d951 into 550d8ec
Browse files Browse the repository at this point in the history
  • Loading branch information
lbloder committed Mar 16, 2023
2 parents 550d8ec + cf5d951 commit f001a34
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- The Spring Boot integration can now be configured to add the `SentryAppender` to specific loggers instead of the `ROOT` logger ([#2173](https://github.com/getsentry/sentry-java/pull/2173))
- You can specify the loggers using `"sentry.logging.loggers[0]=foo.bar` and `"sentry.logging.loggers[1]=baz` in your `application.properties`
- Add capabilities to track Jetpack Compose composition/rendering time ([#2507](https://github.com/getsentry/sentry-java/pull/2507))
- Read integration list written by sentry gradle plugin from manifest ([#2598](https://github.com/getsentry/sentry-java/pull/2598))

### Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.pm.PackageManager;
import android.os.Bundle;
import io.sentry.ILogger;
import io.sentry.SentryIntegrationPackageStorage;
import io.sentry.SentryLevel;
import io.sentry.protocol.SdkVersion;
import io.sentry.util.Objects;
Expand Down Expand Up @@ -86,6 +87,8 @@ final class ManifestMetadataReader {

static final String PERFORM_FRAMES_TRACKING = "io.sentry.traces.frames-tracking";

static final String SENTRY_GRADLE_PLUGIN_INTEGRATIONS = "io.sentry.integrations";

/** ManifestMetadataReader ctor */
private ManifestMetadataReader() {}

Expand Down Expand Up @@ -320,6 +323,16 @@ static void applyMetadata(

options.setSendDefaultPii(
readBool(metadata, logger, SEND_DEFAULT_PII, options.isSendDefaultPii()));

// sdkInfo.addIntegration();

List<String> integrationsFromGradlePlugin =
readList(metadata, logger, SENTRY_GRADLE_PLUGIN_INTEGRATIONS);
if (integrationsFromGradlePlugin != null) {
for (String integration : integrationsFromGradlePlugin) {
SentryIntegrationPackageStorage.getInstance().addIntegration(integration);
}
}
}

options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.mockito.kotlin.verify
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import kotlin.test.assertNull
import kotlin.test.assertTrue

Expand Down Expand Up @@ -1202,4 +1203,19 @@ class ManifestMetadataReaderTest {
// Assert
assertFalse(fixture.options.isEnableTimeToFullDisplayTracing)
}

@Test
fun `applyMetadata reads enabled integrations to SDK Version`() {
// Arrange
val bundle = bundleOf(ManifestMetadataReader.SENTRY_GRADLE_PLUGIN_INTEGRATIONS to "Database Instrumentation,OkHttp Instrumentation")
val context = fixture.getContext(metaData = bundle)

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

// Assert
val resultingSet = fixture.options.sdkVersion?.integrationSet
assertNotNull(resultingSet)
assert(resultingSet.containsAll(listOf("Database Instrumentation", "OkHttp Instrumentation")))
}
}

0 comments on commit f001a34

Please sign in to comment.