Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Merged
merged 10 commits into from
Mar 31, 2021
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Emit the `quantity` field for outcomes of events. This field describes the total size in bytes for attachments or the event count for all other categories. A separate outcome is emitted for attachments in a rejected envelope, if any, in addition to the event outcome. ([#942](https://github.com/getsentry/relay/pull/942))
- Add experimental metrics ingestion without bucketing or pre-aggregation. ([#948](https://github.com/getsentry/relay/pull/948))
- Skip serializing some null values in frames interface. ([#944](https://github.com/getsentry/relay/pull/944))
jan-auer marked this conversation as resolved.
Show resolved Hide resolved

## 21.3.0

Expand Down
11 changes: 10 additions & 1 deletion relay-general/src/protocol/stacktrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ pub struct Frame {
pub abs_path: Annotated<NativeImagePath>,

/// Line number within the source file, starting at 1.
#[metastructure(skip_serialization = "null")]
pub lineno: Annotated<u64>,

/// Column number within the source file, starting at 1.
#[metastructure(skip_serialization = "null")]
pub colno: Annotated<u64>,

/// Which platform this frame is from.
Expand All @@ -93,17 +95,19 @@ pub struct Frame {
pub pre_context: Annotated<Array<String>>,

/// Source code of the current line (`lineno`).
#[metastructure(skip_serialization = "null")]
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.

pub post_context: Annotated<Array<String>>,

/// Override whether this frame should be considered part of application code, or part of
/// libraries/frameworks/dependencies.
///
/// Setting this attribute to `false` causes the frame to be hidden/collapsed by default and
/// mostly ignored during issue grouping.
#[metastructure(skip_serialization = "null")]
pub in_app: Annotated<bool>,

/// Mapping of local variables and expression names that were available in this frame.
Expand All @@ -113,9 +117,11 @@ pub struct Frame {

/// Auxiliary information about the frame that is platform specific.
#[metastructure(omit_from_schema)]
#[metastructure(skip_serialization = "empty")]
pub data: Annotated<FrameData>,

/// (C/C++/Native) Start address of the containing code module (image).
#[metastructure(skip_serialization = "empty")]
pub image_addr: Annotated<Addr>,

/// (C/C++/Native) An optional instruction address for symbolication.
Expand All @@ -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.

pub instruction_addr: Annotated<Addr>,

/// Defines the addressing mode for addresses.
#[metastructure(skip_serialization = "empty")]
pub addr_mode: Annotated<String>,

/// (C/C++/Native) Start address of the frame's function.
///
/// We use the instruction address for symbolication, but this can be used to calculate
/// an instruction offset automatically.
#[metastructure(skip_serialization = "empty")]
pub symbol_addr: Annotated<Addr>,

/// (C/C++/Native) Used for native crashes to indicate how much we can "trust" the instruction_addr
Expand Down