-
Notifications
You must be signed in to change notification settings - Fork 514
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
is_valid_sample_rate may be too strict #1386
Comments
Hey @timharsch ! Thanks for writing in. A really nice solution you have there for having dynamic sample rates for your endpoints. I think there would be an easy fix by just adding a check for decimal here: You can supply a pull request with a fix, if you need this change fast. I have put this in the internal backlog at low priority so it will take quite some time until we can tackle this, because we have a lot on our plates. |
Hmm.. not sure why you are suggesting a change in the record_sql_queries function. It doesn't seem to relate. I believe the fix should be to go from this code on line 132 sentry-python/sentry_sdk/tracing_utils.py Line 132 in 0ba75fe
The float cast on line 141 should cast the Decimal value to float. |
* Fix is_valid_sample_rate to allow check on `Decimal`
@timharsch - Can you please review - #1672 |
fixed by #1672 |
How do you use Sentry?
Sentry Saas (sentry.io)
Version
1.5.6
Steps to Reproduce
One day sentry stopped sending transactions to sentry.io. After much digging I found the issue to be here:
sentry-python/sentry_sdk/tracing.py
Line 668 in 0ba75fe
We have a custom traces_sampler function that reads in from a simple JSON file and sets the sample rate based on the endpoint. An example of our JSON:
We limit our root path
/
, because it gets polled by our load balancer once a minute. And the endpoint is blindingly simple and uninteresting, so we don't want to track all events and blow through our quota.The problem came about when I switch from the
json
package to parse the json, to thejson_encoder
package, which generally is more robust json parser. The issue is that the package json will create a type offloat
when it deserializes the json, json_encoder will create a type ofDecimal
Expected Result
Actual Result
transactions will be skipped if the type returned by traces_sampler function is not of type float.
The text was updated successfully, but these errors were encountered: