Skip to content

Commit da4d0b2

Browse files
authored
fix(relay): Remove parent_span_id from SpanLink struct (#4594)
In #4486 I accidentally defined a `parent_span_id` field on the `SpanLink` struct. This is unnecessary because span links emitted by Otel SDKs via OTLP as well as the JS SDK (as the only Sentry SDK implementing span links so far) never contain a parent span id. This PR therefore removes the field again.
1 parent cd67f90 commit da4d0b2

File tree

5 files changed

+2
-17
lines changed

5 files changed

+2
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
- Add ui chunk profiling data category. ([#4593](https://github.com/getsentry/relay/pull/4593))
1717
- Switch global rate limiter to a service. ([#4581](https://github.com/getsentry/relay/pull/4581))
18+
- Remove `parent_span_link` from `SpanLink` struct. ([#4594](https://github.com/getsentry/relay/pull/4594))
1819

1920
## 25.3.0
2021

relay-event-schema/src/protocol/contexts/trace.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ mod tests {
208208
{
209209
"trace_id": "3c79f60c11214eb38604f4ae0781bfb2",
210210
"span_id": "ea90fdead5f74052",
211-
"parent_span_id": "ea90fdead5f74053",
212211
"sampled": true,
213212
"attributes": {
214213
"sentry.link.type": "previous_trace"
@@ -252,7 +251,6 @@ mod tests {
252251
links: Annotated::new(Array::from(vec![Annotated::new(SpanLink {
253252
trace_id: Annotated::new(TraceId("3c79f60c11214eb38604f4ae0781bfb2".into())),
254253
span_id: Annotated::new(SpanId("ea90fdead5f74052".into())),
255-
parent_span_id: Annotated::new(SpanId("ea90fdead5f74053".into())),
256254
sampled: Annotated::new(true),
257255
attributes: Annotated::new({
258256
let mut map: std::collections::BTreeMap<String, Annotated<Value>> =

relay-event-schema/src/protocol/span.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -753,10 +753,6 @@ pub struct SpanLink {
753753
#[metastructure(required = true, trim = false)]
754754
pub span_id: Annotated<SpanId>,
755755

756-
/// The parent span id of the linked span
757-
#[metastructure(trim = false)]
758-
pub parent_span_id: Annotated<SpanId>,
759-
760756
/// Whether the linked span was positively/negatively sampled
761757
#[metastructure(trim = false)]
762758
pub sampled: Annotated<bool>,
@@ -860,7 +856,6 @@ mod tests {
860856
{
861857
"trace_id": "4c79f60c11214eb38604f4ae0781bfb2",
862858
"span_id": "fa90fdead5f74052",
863-
"parent_span_id": "fa90fdead5f74052",
864859
"sampled": true,
865860
"attributes": {
866861
"boolAttr": true,
@@ -888,7 +883,6 @@ mod tests {
888883
let links = Annotated::new(vec![Annotated::new(SpanLink {
889884
trace_id: Annotated::new(TraceId("4c79f60c11214eb38604f4ae0781bfb2".into())),
890885
span_id: Annotated::new(SpanId("fa90fdead5f74052".into())),
891-
parent_span_id: Annotated::new(SpanId("fa90fdead5f74052".into())),
892886
sampled: Annotated::new(true),
893887
attributes: Annotated::new({
894888
let mut map: std::collections::BTreeMap<String, Annotated<Value>> = Object::new();
@@ -1210,7 +1204,6 @@ mod tests {
12101204
{
12111205
"trace_id": "5c79f60c11214eb38604f4ae0781bfb2",
12121206
"span_id": "ab90fdead5f74052",
1213-
"parent_span_id": "eb90fdead5f74052",
12141207
"sampled": true,
12151208
"attributes": {
12161209
"sentry.link.type": "previous_trace"
@@ -1219,7 +1212,6 @@ mod tests {
12191212
{
12201213
"trace_id": "4c79f60c11214eb38604f4ae0781bfb2",
12211214
"span_id": "fa90fdead5f74052",
1222-
"parent_span_id": "fa90fdead5f74052",
12231215
"sampled": true,
12241216
"attributes": {
12251217
"sentry.link.type": "next_trace"
@@ -1231,7 +1223,7 @@ mod tests {
12311223
let span: Annotated<Span> = Annotated::from_json(span).unwrap();
12321224
assert_eq!(
12331225
span.to_json().unwrap(),
1234-
r#"{"links":[{"trace_id":"5c79f60c11214eb38604f4ae0781bfb2","span_id":"ab90fdead5f74052","parent_span_id":"eb90fdead5f74052","sampled":true,"attributes":{"sentry.link.type":"previous_trace"}},{"trace_id":"4c79f60c11214eb38604f4ae0781bfb2","span_id":"fa90fdead5f74052","parent_span_id":"fa90fdead5f74052","sampled":true,"attributes":{"sentry.link.type":"next_trace"}}]}"#
1226+
r#"{"links":[{"trace_id":"5c79f60c11214eb38604f4ae0781bfb2","span_id":"ab90fdead5f74052","sampled":true,"attributes":{"sentry.link.type":"previous_trace"}},{"trace_id":"4c79f60c11214eb38604f4ae0781bfb2","span_id":"fa90fdead5f74052","sampled":true,"attributes":{"sentry.link.type":"next_trace"}}]}"#
12351227
);
12361228
}
12371229
}

relay-event-schema/src/protocol/span/convert.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ mod tests {
110110
{
111111
"trace_id": "4c79f60c11214eb38604f4ae0781bfb2",
112112
"span_id": "fa90fdead5f74052",
113-
"parent_span_id": "fa90fdead5f74053",
114113
"sampled": true,
115114
"attributes": {
116115
"sentry.link.type": "previous_trace"
@@ -245,9 +244,6 @@ mod tests {
245244
span_id: SpanId(
246245
"fa90fdead5f74052",
247246
),
248-
parent_span_id: SpanId(
249-
"fa90fdead5f74053",
250-
),
251247
sampled: true,
252248
attributes: {
253249
"sentry.link.type": String(

relay-spans/src/span.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,6 @@ fn otel_to_sentry_link(otel_link: OtelLink) -> SpanLink {
234234
span_id: SpanId(hex::encode(otel_link.span_id)).into(),
235235
sampled: (otel_link.flags & W3C_TRACE_CONTEXT_SAMPLED != 0).into(),
236236
attributes,
237-
// The parent span ID is not available over OTLP.
238-
parent_span_id: Annotated::empty(),
239237
other: Default::default(),
240238
}
241239
}

0 commit comments

Comments
 (0)