We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a48fafd commit 6e0b02bCopy full SHA for 6e0b02b
1 file changed
sentry_sdk/tracing_utils.py
@@ -4,6 +4,7 @@
4
import math
5
6
from numbers import Real
7
+from decimal import Decimal
8
9
import sentry_sdk
10
from sentry_sdk.consts import OP
@@ -131,8 +132,8 @@ def is_valid_sample_rate(rate):
131
132
133
# both booleans and NaN are instances of Real, so a) checking for Real
134
# checks for the possibility of a boolean also, and b) we have to check
- # separately for NaN
135
- if not isinstance(rate, Real) or math.isnan(rate):
+ # separately for NaN and Decimal does not derive from Real so need to check that too
136
+ if not isinstance(rate, (Real, Decimal)) or math.isnan(rate):
137
logger.warning(
138
"[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got {rate} of type {type}.".format(
139
rate=rate, type=type(rate)
0 commit comments