Problem Statement
The Sentry SDK documentation lists SENTRY_SAMPLE_RATE as an expected environment variable that SDKs should support. This variable controls the percentage of error events sent to Sentry (0.0 to 1.0).
The Java SDK currently supports all other expected environment variables:
- ✓
SENTRY_DSN
- ✓
SENTRY_RELEASE
- ✓
SENTRY_ENVIRONMENT
- ✓
SENTRY_TRACES_SAMPLE_RATE
- ✓
SENTRY_PROFILES_SAMPLE_RATE
- ✓
SENTRY_DEBUG
- ❌
SENTRY_SAMPLE_RATE (missing)
Current Behavior
The SentryOptions class has a sampleRate property that can be set programmatically via options.setSampleRate(), but ExternalOptions.from() does not read this property from the properties provider.
Expected Behavior
Users should be able to set SENTRY_SAMPLE_RATE environment variable to configure error event sampling.
Solution
Add the following to ExternalOptions:
- Add a
sampleRate field
- Read it in
from() via propertiesProvider.getDoubleProperty("sample-rate")
- Merge it in
SentryOptions.merge()
Problem Statement
The Sentry SDK documentation lists
SENTRY_SAMPLE_RATEas an expected environment variable that SDKs should support. This variable controls the percentage of error events sent to Sentry (0.0 to 1.0).The Java SDK currently supports all other expected environment variables:
SENTRY_DSNSENTRY_RELEASESENTRY_ENVIRONMENTSENTRY_TRACES_SAMPLE_RATESENTRY_PROFILES_SAMPLE_RATESENTRY_DEBUGSENTRY_SAMPLE_RATE(missing)Current Behavior
The
SentryOptionsclass has asampleRateproperty that can be set programmatically viaoptions.setSampleRate(), butExternalOptions.from()does not read this property from the properties provider.Expected Behavior
Users should be able to set
SENTRY_SAMPLE_RATEenvironment variable to configure error event sampling.Solution
Add the following to
ExternalOptions:sampleRatefieldfrom()viapropertiesProvider.getDoubleProperty("sample-rate")SentryOptions.merge()