Sentry-java: stacktrace.app.packages can not be configed in code

Created on 29 May 2018  路  6Comments  路  Source: getsentry/sentry-java

When initializing sentry in java, parameters like release and servername could be set on SentryClient, but I don't see an option for setting stacktrace.app.packages. Is this a intended behavior or a bug? What are the workarounds?

enhancement

Most helpful comment

Note that one workaround could be to add the stacktrace.app.packages=<whatever> as a query parameter to the DSN
<DSN>?stacktrace.app.packages=<PACKAGE>

This is what I am currently doing but I would rather have it as a separate option.

All 6 comments

Is there a reason you need to configure it on a SentryClient instance? It can be configured via the Client DSN, sentry.properties, Java System Properties or System Environment Variables: https://docs.sentry.io/clients/java/config/#configuration-methods

EDIT: Though I agree that there is a confusing distinction between options that can be configured on the client itself and those that can't.

I'm writing a springboot project and I wanted to use different sentry configuration per springboot active profile which I couldn't manage using sentry.properties. (I know this could be set via system properties or env vars but I liked to set sentry properties in application.yml file).
I couldn't find a way so decided to define a configuration in my code and load parameters from application.yml and initialize a SentryClient. Release and servername were available but stacktrace.app.package, sample.rate and some other properties were missing. I thought this was a bug but seems its intended.
And also, some guide or tutorial on configuring sentry with springboot would be great.

We probably should add more configuration to the SentryClient itself.

As for configuration, I would just follow the configuration guide for the logging framework you use: https://docs.sentry.io/clients/java/modules/

Note that one workaround could be to add the stacktrace.app.packages=<whatever> as a query parameter to the DSN
<DSN>?stacktrace.app.packages=<PACKAGE>

This is what I am currently doing but I would rather have it as a separate option.

+1 for this issue. I am not able to use the sentry properties file or environment/system variables to configure sentry for my project, since I can't configure stacktrace.app.packages= programmatically I constantly see warnings about this. Quite annoying.

In the new, just released Java SDK v3 app packages can be configured in the code:

Sentry.init(options -> options.addInAppInclude(...));
Was this page helpful?
0 / 5 - 0 ratings