You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using MessagePack to serialize data before storing them into Redis. The encoding of the string returned by MessagePack is ASCII_8BIT. This string is captured in a Sentry span description, and the serialization into JSON fails due to the invalid encoding:
We try to fix this issue using the before_send hook, but unfortunately we've not been able to find spans in the event object.
We finally fixed this issue by monkey patching the set_description method of the Sentry::Span class:
Is this a known issue that should be fixed in Sentry SDK directly? If not, is there a way to deal with non UTF-8 string using the before_send hook?
Reproduction Steps
In a Rails project with Sentry and MessagePack installed:
@sl0thentr0py Yes, correct! So the key is displayed in the Sentry span description, and serialization to JSON fails due to non UTF-8 characters (the ones from the key that has been MessagePack'd.
Issue Description
(Similar to #1911)
Hello,
I got the error
Transaction sending failed: "\xD9" from ASCII-8BIT to UTF-8
that's raised from this method:sentry-ruby/sentry-ruby/lib/sentry/envelope.rb
Lines 12 to 15 in 193446b
Here is the log:
We're using MessagePack to serialize data before storing them into Redis. The encoding of the string returned by MessagePack is
ASCII_8BIT
. This string is captured in a Sentry span description, and the serialization into JSON fails due to the invalid encoding:We try to fix this issue using the
before_send
hook, but unfortunately we've not been able to find spans in the event object.We finally fixed this issue by monkey patching the
set_description
method of theSentry::Span
class:Is this a known issue that should be fixed in Sentry SDK directly? If not, is there a way to deal with non UTF-8 string using the
before_send
hook?Reproduction Steps
In a Rails project with Sentry and MessagePack installed:
Sentry.capture_message(MessagePack.pack('test message'))
Expected Behavior
Event is sent to Sentry.
Actual Behavior
Event isn't sent to Sentry.
Ruby Version
2.7.4
SDK Version
5.7.0
Integration and Its Version
rails (6.0.5.1), sentry-rails (5.7.0), sidekiq (5.2.2), sentry-sidekiq (5.7.0)
Sentry Config
The text was updated successfully, but these errors were encountered: