Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SENTRY_TRACES_SAMPLE_RATE conf. via env variables. #1171

Merged
merged 3 commits into from
Jan 15, 2021

Conversation

maciejwalkowiak
Copy link
Contributor

📜 Description

Support SENTRY_TRACES_SAMPLE_RATE conf. via env variables.

💡 Motivation and Context

Fixes #1169

💚 How did you test it?

Unit tests.

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • All tests passing
  • No breaking changes

@codecov-io
Copy link

codecov-io commented Jan 15, 2021

Codecov Report

Merging #1171 (6f8e6aa) into main (931464f) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1171      +/-   ##
============================================
+ Coverage     75.25%   75.27%   +0.02%     
- Complexity     1662     1665       +3     
============================================
  Files           173      173              
  Lines          5812     5817       +5     
  Branches        568      570       +2     
============================================
+ Hits           4374     4379       +5     
  Misses         1174     1174              
  Partials        264      264              
Impacted Files Coverage Δ Complexity Δ
sentry/src/main/java/io/sentry/SentryOptions.java 85.19% <100.00%> (+0.16%) 114.00 <0.00> (+1.00)
...main/java/io/sentry/config/PropertiesProvider.java 100.00% <100.00%> (ø) 8.00 <2.00> (+2.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 931464f...6f8e6aa. Read the comment docs.

@Nullable
default Double getDoubleProperty(final @NotNull String property) {
final String result = getProperty(property);
return result != null ? Double.valueOf(result) : null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we account if it's not a Double? like catch NumberFormatException and return null?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this is done at startup and the value must be double, probably OK to blow up here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's o but kinda goes against our philosophy

https://develop.sentry.dev/sdk/philosophy/#degrade-gracefully

I'd prefer blowing up only if there's no DSN, any other reason would be a bug IMO

@Nullable
default Double getDoubleProperty(final @NotNull String property) {
final String result = getProperty(property);
return result != null ? Double.valueOf(result) : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this is done at startup and the value must be double, probably OK to blow up here

@maciejwalkowiak maciejwalkowiak merged commit 681c759 into main Jan 15, 2021
@maciejwalkowiak maciejwalkowiak deleted the gh-1169 branch January 15, 2021 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support SENTRY_TRACES_SAMPLE_RATE conf. via env. variables
4 participants