Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(stacktrace): Skip serializing some null values in frames interface #944

Merged
merged 10 commits into from Mar 31, 2021

Conversation

untitaker
Copy link
Member

Noticed this while reviewing events: We serialize a lot of null keys for every frame which are not necessary on all platforms.

@untitaker untitaker requested a review from a team March 8, 2021 17:35
Copy link
Member

@jan-auer jan-auer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merging this, please do a careful audit of Sentry code to ensure that no code expects these attributes to be present. This is effectively a schema change, and thus has the potential to introduce regressions in Sentry, which we do not have E2E tests here.

@@ -93,6 +95,7 @@ pub struct Frame {
pub pre_context: Annotated<Array<String>>,

/// Source code of the current line (`lineno`).
#[metastructure(skip_serialization = "empty")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be null. We use context_line in Sentry to check if there is source context, and in theory the context line can be an empty string.

@@ -104,6 +107,7 @@ pub struct Frame {
///
/// Setting this attribute to `false` causes the frame to be hidden/collapsed by default and
/// mostly ignored during issue grouping.
#[metastructure(skip_serialization = "empty")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty for booleans and numbers is always false, so let's use null in those instances, too.

@untitaker
Copy link
Member Author

I've verified that none of those values are required by the frames interface in Sentry nor the Snuba errors processor.

@untitaker untitaker changed the title fix(stacktrace): Skip more null values fix(stacktrace): Skip more null values in frames interface Mar 17, 2021
@untitaker untitaker changed the title fix(stacktrace): Skip more null values in frames interface fix(stacktrace): Skip serializing some null values in frames interface Mar 17, 2021
Copy link
Member

@jan-auer jan-auer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with my comments considered.

CHANGELOG.md Show resolved Hide resolved
pub context_line: Annotated<String>,

/// Source code of the lines after `lineno`.
#[metastructure(skip_serialization = "empty")]
#[metastructure(skip_serialization = "null")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty is fine for the arrays, especially since you only changed it for post_context but not pre_context. Let's stick with empty.

@@ -124,15 +130,18 @@ pub struct Frame {
/// If this is set and a known image is defined in the
/// [Debug Meta Interface]({%- link _documentation/development/sdk-dev/event-payloads/debugmeta.md -%}),
/// then symbolication can take place.
#[metastructure(skip_serialization = "empty")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these are scalar values, let's use null here.

@untitaker untitaker enabled auto-merge (squash) March 31, 2021 12:24
@untitaker untitaker merged commit 9d7c185 into master Mar 31, 2021
@untitaker untitaker deleted the fix/skip-null-values branch March 31, 2021 12:32
jan-auer added a commit that referenced this pull request Apr 2, 2021
* master:
  test(server): Fix flaky shutdown test (#970)
  fix(stacktrace): Skip serializing some null values in frames interface (#944)
  release: 0.8.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants