relay icon indicating copy to clipboard operation
relay copied to clipboard

Cannot parse DSC from envelope

Open Dav1dde opened this issue 1 year ago • 4 comments

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.

Dav1dde avatar Oct 02 '24 15:10 Dav1dde

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 avatar Oct 03 '24 08:10 jan-auer

@jan-auer Should we be a bit more lenient here and accept both (string and numerical) or just close this?

Dav1dde avatar Oct 03 '24 08:10 Dav1dde

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.

Dav1dde avatar Oct 03 '24 08:10 Dav1dde

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

antonpirker avatar Oct 03 '24 13:10 antonpirker