Skip to content

Showing key-value pairs when null value is provided to context  #72890

@bml1g12

Description

@bml1g12

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, 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.

Solution Brainstorm

Either add clear documentation that parents with null values are omitted, or even better, do not omit these

Product Area

Issues

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions