Sentry-java: Spring Boot external configuration - Env. variables delete values set by other configuration methods

Created on 16 Oct 2020  路  6Comments  路  Source: getsentry/sentry-java

_Platform:_

  • [ ] Android -> If yes, which Device API (and compileSdkVersion/targetSdkVersion/Build tools) version?
  • [ ] Java -> If yes, which Java (and sourceCompatibility/targetCompatibility) version?
  • [x] Kotlin -> If yes, which Kotlin (and jvmTarget) version? Kotlin = 1.3.71, JVM = 1.8
  • [ ] NDK -> If yes, which NDK/CMake version?
  • [ ] React-Native -> If yes, which version?
  • [ ] Timber -> If yes, which version?
  • [ ] Log4j2 -> If yes, which version?
  • [x] Logback -> If yes, which version?
  • [x] Spring -> If yes, which version? Spring boot 2.2.6.RELEASE

_IDE:_

  • [ ] Android Studio -> If yes, which version?
  • [x] IntelliJ -> If yes, which version?
  • [ ] Other -> If yes, which one?

_Build system:_

  • [ ] Gradle -> If yes, which version?
  • [ ] Buck -> If yes, which version?
  • [ ] Bazel -> If yes, which version?
  • [x] Maven -> If yes, which version? 3.6.0
  • [ ] Other -> If yes, which one?

_Android Gradle Plugin:_

  • [ ] Yes -> If yes, which version?
  • [ ] No

_Sentry Android Gradle Plugin:_

  • [ ] Yes -> If yes, which version?
  • [ ] No

_Proguard/R8:_

  • [ ] Enabled
  • [ ] Disabled

_Platform installed with:_

  • [ ] JCenter
  • [ ] Bintray
  • [x] Maven Central
  • [ ] Manually

The version of the SDK:
3.1.0


I have the following issue:

When I use 2 external config methods, application.yml and Environment variables, the configs from application.yml are lost.

Steps to reproduce:

  • Add to pom.xml
        <dependency>
            <groupId>io.sentry</groupId>
            <artifactId>sentry-spring-boot-starter</artifactId>
            <version>${sentry.version}</version>
        </dependency>
        <dependency>
            <groupId>io.sentry</groupId>
            <artifactId>sentry-logback</artifactId>
            <version>${sentry.version}</version>
        </dependency>
  • Configure application.yml:
sentry:
  in-app-includes:
    - com.my.package
  environment: Dev
  • Configure environment variables
SENTRY_DSN="https://<redacted>"

Actual result:

Note: the DSN value is correctly set

mainHub.options:

eventProcessors = {CopyOnWriteArrayList@16781}  size = 2
integrations = {CopyOnWriteArrayList@16782}  size = 2
dsn = "https://<redacted>"
...
environment = null
...
inAppIncludes = {CopyOnWriteArrayList@16790}  size = 0
...
enableExternalConfiguration = true

Expected result:

mainHub.options:

eventProcessors = {CopyOnWriteArrayList@16781}  size = 2
integrations = {CopyOnWriteArrayList@16782}  size = 2
dsn = "https://<snipped>"
...
environment = null
...
inAppIncludes = ["com.my.package"]
...
enableExternalConfiguration = true
triage

All 6 comments

Wow, that was fast @maciejwalkowiak. Thanks!

Any idea when the next release is planned for?

@chrsblck the beginning of next week 馃檪

@maciejwalkowiak @marandaneto Awesome, thank you!

One small thing I noticed, not sure if this is intended, or an Intellij issue, but I've set in-app-includes once in application.yml but I see it twice in the main-hub.options

inAppIncludes = ... = size = 2
0=my.package.app
1=my.package.app

Just wanted to point this out, doesn't seem so critical

@chrsblck starting from 3.1.0 in Spring Boot integration we auto-detect inAppIncludes by taking the package of @SpringBootApplication annotated class (https://github.com/getsentry/sentry-java/pull/966).

Ah, that's even better! I didn't try removing it when I updating from 3.1.0 to 3.1.1

Was this page helpful?
0 / 5 - 0 ratings