Cannot parse DSC from envelope
Relay fails to parse the DSC with the debug message failed to parse sampling context error=invalid type: floating point 1, expected a string.
relay-1 | 2024-10-02T08:04:02.957498Z DEBUG relay_server::envelope: failed to parse sampling context error=invalid type: floating point `1`, expected a string
Originally seen here: https://github.com/getsentry/self-hosted/issues/3312#issuecomment-2387900625
It looks like Relay expects the sample rate to be a string, we can be a bit more lenient if that is the issue: https://github.com/getsentry/relay/blob/9f45b023dbce26261cc7035ca5c2349490449222/relay-sampling/src/dsc.rs#L152-L154
COS:
- Verify with the mentioned/used SDK
- Fix the issue
Note: This error does not cause dropped events and for self hosted is without consequences.
This is expected. As per spec, the sample rate must be sent as a string, this is a buggy SDK: https://develop.sentry.dev/sdk/telemetry/traces/dynamic-sampling-context/#dsc-specification
Consequence of this is that distributed DS and extrapolation will not work, the data will be stored, however.
@jan-auer Should we be a bit more lenient here and accept both (string and numerical) or just close this?
Created an issue in the Python SDK, but I think we should just be more lenient in Relay to have a working DSC for all clients using an older SDK version.
This is a problem in the Python SDK. The sample_rate in the envelope headers of an error is indeed a float instead of a str. (for envelopes containing transactions it is correct.)
We have fix and will probably release it next week: https://github.com/getsentry/sentry-python/pull/3603