LogEvent does not correctly handle nested attributes (e.g., Rails ActionController params)
Issue Description
Sentry::LogEvent does not correctly handle nested attributes (such as Rails ActionController's params)
Reproduction Steps
-
Clone repo https://github.com/vivekmiyani/bookmarks.git
-
Run rails server
SENTRY_DSN=REPLACE_ME rails s -
Trigger endpoint
curl -X POST http://localhost:3000/bookmarks.json -H "Content-Type: application/json" -d '{"bookmark":{"title":"Hello world","url":"Hello world"}}' -
Notice that it doesn't show params passed in logs sentry page
Expected Behavior
- Params should be included in logs sentry page as per action controller logs integration docs
Actual Behavior
- Passed params is not present
Ruby Version
3.4.5
SDK Version
6.2.0
Integration and Its Version
Rails
Sentry Config
Sentry config
@solnic, I checked other SDKs, and they seem to handle this correctly:
So I implemented a similar solution for Ruby in my fork: https://github.com/getsentry/sentry-ruby/compare/master...vivekmiyani:sentry-ruby:master?expand=1
A couple of questions before raising a PR:
- Is it okay to use
JSON.generatehere? - Or should we use
#inspect(similar to Python'srepr) instead?
Happy to raise PR once you approve the issue :)
@vivekmiyani thank you for reporting the issue and offering help ❤️ Please feel free to open a PR and using JSON like you mentioned. The subscriber is using params filtering by default already so it should be safe.