Skip to content

Commit 115d12a

Browse files
authored
Java tracesSampler callback allows returning null (#12499)
1 parent 0f0e47d commit 115d12a

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
To use the sampling function, set the <PlatformIdentifier name="traces-sampler" /> option in your `SentryAndroid.init()` to a function that will accept a <PlatformIdentifier name="sampling-context" /> dictionary and return a sample rate between 0 and 1. For example:
1+
To use the sampling function, set the <PlatformIdentifier name="traces-sampler" /> option in your `SentryAndroid.init()` to a function that will accept a <PlatformIdentifier name="sampling-context" /> dictionary and return a sample rate between 0 and 1. You should return the parent sampling decision if there is one. You may also return `null` and let the Java SDK make the decision as if no <PlatformIdentifier name="traces-sampler" /> was set. For example:
22

33
<PlatformContent includePath="performance/traces-sampler-as-sampler" />
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
To use the sampling function, set the <PlatformIdentifier name="traces-sampler" /> option in your `Sentry.init()` to a function that will accept a <PlatformIdentifier name="sampling-context" /> dictionary and return a sample rate between 0 and 1. For example:
1+
To use the sampling function, set the <PlatformIdentifier name="traces-sampler" /> option in your `Sentry.init()` to a function that will accept a <PlatformIdentifier name="sampling-context" /> dictionary and return a sample rate between 0 and 1. You should return the parent sampling decision if there is one. You may also return `null` and let the Java SDK make the decision as if no <PlatformIdentifier name="traces-sampler" /> was set. For example:
22

33
<PlatformContent includePath="performance/traces-sampler-as-sampler" />

platform-includes/performance/traces-sampler-as-sampler/android.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ SentryAndroid.init(this, options -> {
2525
return 0.0;
2626
} else {
2727
// Default sample rate
28-
return 0.1;
28+
return null;
2929
}
3030
} else {
31-
return 0.1;
31+
return null;
3232
}
3333
});
3434
});
@@ -61,11 +61,11 @@ SentryAndroid.init(this) { options ->
6161
}
6262
else -> {
6363
// Default sample rate
64-
0.1
64+
null
6565
}
6666
}
6767
} else {
68-
0.1
68+
null
6969
}
7070
}
7171
}

platform-includes/performance/traces-sampler-as-sampler/java.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ Sentry.init(options -> {
2626
return 0.0;
2727
} else {
2828
// Default sample rate
29-
return 0.1;
29+
return null;
3030
}
3131
} else {
32-
return 0.1;
32+
return null;
3333
}
3434
});
3535
});
@@ -62,11 +62,11 @@ Sentry.init { options ->
6262
}
6363
else -> {
6464
// Default sample rate
65-
0.1
65+
null
6666
}
6767
}
6868
} else {
69-
0.1
69+
null
7070
}
7171
}
7272
}

0 commit comments

Comments
 (0)