Showing key-value pairs when `null` value is provided to context
- Dominant language
- Python
- Stars
- 44.8k
- Forks
- 4.9k
- Avg merge
- 22h 21m
- Merged PRs (30d)
- 586
Description
### Problem Statement
When I log the following context: {"myContext": `null`} but the context then gets omitted entirely. This makes senss to me for `undefined` values, but doesn't make sense to me for values explicity defined as `null`. I get the expected behaviour when I nest it in an object like {"myContext": {"nestedContext": null}} - this context does not get omitted.
Talking to Sentry support they said:
> The behavior you're observing, where null values in the top-level context are omitted while nested null values are preserved (and undefined values are omitted), is indeed the intended behavior. Essentially, the choice for this was to help reduce noise in the issue details by omitting values that might not be meaningful in all contexts.
> This does not appear to be documented in the [Contexts Interface](https://develop.sentry.dev/sdk/event-payloads/contexts/), but I see your point with the use of seeing all null values in the logs. I would recommend if you would like to see this improved in the future, you can submit a request [via our repository](https://github.com/getsentry/sentry/issues/new?assignees=&labels=&template=feature.yml).
### Solution Brainstorm
Either add clear documentation that parents with `null` values are omitted, or even better, do not omit these
### Product Area
Issues
Contributor guide
Assessment
This issue has not been assessed yet.