Skip to content

Commit ac47816

Browse files
authored
feat(protocol): Add lock attribute to the frame protocol (#2171)
1 parent 149e985 commit ac47816

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
**Features**:
6+
7+
- Add support for X-Vercel-Forwarded-For header. ([#2124](https://github.com/getsentry/relay/pull/2124))
8+
- Add `lock` attribute to the frame protocol. ([#2171](https://github.com/getsentry/relay/pull/2171))
9+
310
## 23.5.2
411

512
**Features**:
613

714
- Use different error message for empty strings in schema processing. ([#2151](https://github.com/getsentry/relay/pull/2151))
8-
- Add support for X-Vercel-Forwarded-For header. ([#2124](https://github.com/getsentry/relay/pull/2124))
915

1016
## 23.5.1
1117

relay-general/src/protocol/stacktrace.rs

+21-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::str::FromStr;
55

66
use serde::{Deserialize, Serialize};
77

8-
use crate::protocol::{Addr, NativeImagePath, RegVal};
8+
use crate::protocol::{Addr, LockReason, NativeImagePath, RegVal};
99
use crate::types::{
1010
Annotated, Array, Empty, ErrorKind, FromValue, IntoValue, Object, SkipSerialization, Value,
1111
};
@@ -185,6 +185,10 @@ pub struct Frame {
185185
#[metastructure(skip_serialization = "null")]
186186
pub stack_start: Annotated<bool>,
187187

188+
/// A possible lock (java monitor object) held by this frame.
189+
#[metastructure(skip_serialization = "null")]
190+
pub lock: Annotated<LockReason>,
191+
188192
/// Additional arbitrary fields for forwards compatibility.
189193
#[metastructure(additional_properties)]
190194
pub other: Object<Value>,
@@ -506,6 +510,7 @@ impl From<Stacktrace> for RawStacktrace {
506510

507511
#[cfg(test)]
508512
mod tests {
513+
use crate::protocol::{LockReasonType, ThreadId};
509514
use similar_asserts::assert_eq;
510515

511516
use super::*;
@@ -544,6 +549,13 @@ mod tests {
544549
"trust": "69",
545550
"lang": "rust",
546551
"stack_start": true,
552+
"lock": {
553+
"type": 2,
554+
"address": "0x07d7437b",
555+
"package_name": "io.sentry.samples",
556+
"class_name": "MainActivity",
557+
"thread_id": 7
558+
},
547559
"other": "value"
548560
}"#;
549561
let frame = Annotated::new(Frame {
@@ -581,6 +593,14 @@ mod tests {
581593
trust: Annotated::new("69".into()),
582594
lang: Annotated::new("rust".into()),
583595
stack_start: Annotated::new(true),
596+
lock: Annotated::new(LockReason {
597+
ty: Annotated::new(LockReasonType::Waiting),
598+
address: Annotated::new("0x07d7437b".to_string()),
599+
package_name: Annotated::new("io.sentry.samples".to_string()),
600+
class_name: Annotated::new("MainActivity".to_string()),
601+
thread_id: Annotated::new(ThreadId::Int(7)),
602+
other: Default::default(),
603+
}),
584604
other: {
585605
let mut vars = Object::new();
586606
vars.insert(

relay-general/tests/snapshots/test_fixtures__event_schema.snap

+12
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,18 @@ expression: "relay_general::protocol::event_json_schema()"
16481648
"format": "uint64",
16491649
"minimum": 0.0
16501650
},
1651+
"lock": {
1652+
"description": " A possible lock (java monitor object) held by this frame.",
1653+
"default": null,
1654+
"anyOf": [
1655+
{
1656+
"$ref": "#/definitions/LockReason"
1657+
},
1658+
{
1659+
"type": "null"
1660+
}
1661+
]
1662+
},
16511663
"module": {
16521664
"description": " Name of the module the frame is contained in.\n\n Note that this might also include a class name if that is something the\n language natively considers to be part of the stack (for instance in Java).",
16531665
"default": null,

0 commit comments

Comments
 (0)