Skip to content

Commit

Permalink
Merge branch 'main' into feat/support-thread-local-accessor-for-reactor
Browse files Browse the repository at this point in the history
  • Loading branch information
adinauer authored Mar 1, 2023
2 parents 5b12e27 + d691d8f commit ea3be7d
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ jobs:
${{ runner.os }}-gradle-
- name: Initialize CodeQL
uses: github/codeql-action/init@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # pin@v2
uses: github/codeql-action/init@32dc499307d133bb5085bae78498c0ac2cf762d5 # pin@v2
with:
languages: ${{ matrix.language }}

- run: |
./gradlew assemble
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # pin@v2
uses: github/codeql-action/analyze@32dc499307d133bb5085bae78498c0ac2cf762d5 # pin@v2
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
### Fixes

- Leave `inApp` flag for stack frames undecided in SDK if unsure and let ingestion decide instead ([#2547](https://github.com/getsentry/sentry-java/pull/2547))
- Allow `0.0` error sample rate ([#2573](https://github.com/getsentry/sentry-java/pull/2573))
- Use the same hub in WebFlux exception handler as we do in WebFilter ([#2566](https://github.com/getsentry/sentry-java/pull/2566))

## 6.14.0
Expand Down
1 change: 0 additions & 1 deletion sentry/api/sentry.api
Original file line number Diff line number Diff line change
Expand Up @@ -3794,7 +3794,6 @@ public final class io/sentry/util/SampleRateUtils {
public fun <init> ()V
public static fun isValidProfilesSampleRate (Ljava/lang/Double;)Z
public static fun isValidSampleRate (Ljava/lang/Double;)Z
public static fun isValidSampleRate (Ljava/lang/Double;Z)Z
public static fun isValidTracesSampleRate (Ljava/lang/Double;)Z
public static fun isValidTracesSampleRate (Ljava/lang/Double;Z)Z
}
Expand Down
4 changes: 2 additions & 2 deletions sentry/src/main/java/io/sentry/SentryOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ public void setProxy(@Nullable Proxy proxy) {
}

/**
* Sets the sampleRate Can be anything between 0.01 and 1.0 or null (default), to disable it.
* Sets the sampleRate Can be anything between 0.0 and 1.0 or null (default), to disable it.
*
* @param sampleRate the sample rate
*/
Expand All @@ -823,7 +823,7 @@ public void setSampleRate(Double sampleRate) {
throw new IllegalArgumentException(
"The value "
+ sampleRate
+ " is not valid. Use null to disable or values > 0.0 and <= 1.0.");
+ " is not valid. Use null to disable or values >= 0.0 and <= 1.0.");
}
this.sampleRate = sampleRate;
}
Expand Down
10 changes: 1 addition & 9 deletions sentry/src/main/java/io/sentry/util/SampleRateUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@
public final class SampleRateUtils {

public static boolean isValidSampleRate(@Nullable Double sampleRate) {
return isValidSampleRate(sampleRate, true);
}

public static boolean isValidSampleRate(@Nullable Double sampleRate, boolean allowNull) {
if (sampleRate == null) {
return allowNull;
}

return !(sampleRate.isNaN() || sampleRate > 1.0 || sampleRate <= 0.0);
return isValidRate(sampleRate, true);
}

public static boolean isValidTracesSampleRate(@Nullable Double tracesSampleRate) {
Expand Down
5 changes: 0 additions & 5 deletions sentry/src/test/java/io/sentry/SentryOptionsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ class SentryOptionsTest {
assertFailsWith<IllegalArgumentException> { SentryOptions().sampleRate = -0.0000000000001 }
}

@Test
fun `when setSampling is set to exactly 0, setter throws`() {
assertFailsWith<IllegalArgumentException> { SentryOptions().sampleRate = 0.0 }
}

@Test
fun `when setTracesSampleRate is set to exactly 0, value is set`() {
val options = SentryOptions().apply {
Expand Down
14 changes: 2 additions & 12 deletions sentry/src/test/java/io/sentry/util/SampleRateUtilTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class SampleRateUtilTest {
}

@Test
fun `rejects 0 for sample rate`() {
assertFalse(SampleRateUtils.isValidSampleRate(0.0))
fun `accepts 0 for sample rate`() {
assertTrue(SampleRateUtils.isValidSampleRate(0.0))
}

@Test
Expand Down Expand Up @@ -46,16 +46,6 @@ class SampleRateUtilTest {
assertFalse(SampleRateUtils.isValidSampleRate(Double.NEGATIVE_INFINITY))
}

@Test
fun `accepts null sample rate if told so`() {
assertTrue(SampleRateUtils.isValidSampleRate(null, true))
}

@Test
fun `rejects null sample rate if told so`() {
assertFalse(SampleRateUtils.isValidSampleRate(null, false))
}

@Test
fun `accepts 0 for traces sample rate`() {
assertTrue(SampleRateUtils.isValidTracesSampleRate(0.0))
Expand Down

0 comments on commit ea3be7d

Please sign in to comment.