Skip to content

Commit 69874ae

Browse files
jjbayerDav1dde
andauthored
feat(spans): Align otel attributes with sentry span (#3457)
To simplify conversion in the future, align attribute names in Otel's span attributes with keys in Sentry's `span.data`. The old keys in `span.data` remain as legacy alias. See also getsentry/develop#1230 for the span schema / attribute convention. ref: #3278 --------- Co-authored-by: David Herberth <[email protected]>
1 parent b57381a commit 69874ae

File tree

8 files changed

+258
-114
lines changed

8 files changed

+258
-114
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
- Respect country code TLDs when scrubbing span tags. ([#3458](https://github.com/getsentry/relay/pull/3458))
88

9+
**Features**:
10+
11+
- Use same keys for OTel span attributes and Sentry span data. ([#3457](https://github.com/getsentry/relay/pull/3457))
12+
913
**Internal**:
1014

1115
- Emit gauges for total and self times for spans. ([#3448](https://github.com/getsentry/relay/pull/3448))
@@ -14,7 +18,7 @@
1418

1519
**Features**:
1620

17-
- Add inbound filters for Annotated<Replay> types. ([#3420](https://github.com/getsentry/relay/pull/3420))
21+
- Add inbound filters for `Annotated<Replay>` types. ([#3420](https://github.com/getsentry/relay/pull/3420))
1822
- Add Linux distributions to os context. ([#3443](https://github.com/getsentry/relay/pull/3443))
1923

2024
**Internal:**

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ pub struct SpanData {
200200
pub db_system: Annotated<Value>,
201201

202202
/// The sentry environment.
203-
#[metastructure(field = "environment")]
203+
#[metastructure(field = "sentry.environment", legacy_alias = "environment")]
204204
pub environment: Annotated<String>,
205205

206206
/// The release version of the project.
207-
#[metastructure(field = "release")]
207+
#[metastructure(field = "sentry.release", legacy_alias = "release")]
208208
pub release: Annotated<LenientString>,
209209

210210
/// The decoded body size of the response (in bytes).
@@ -276,7 +276,7 @@ pub struct SpanData {
276276
/// This corresponds to the transaction name in the transaction-based model.
277277
///
278278
/// For INP spans, this is the route name where the interaction occurred.
279-
#[metastructure(field = "segment.name", legacy_alias = "transaction")]
279+
#[metastructure(field = "sentry.segment.name", legacy_alias = "transaction")]
280280
pub segment_name: Annotated<String>,
281281

282282
/// Name of the UI component (e.g. React).
@@ -292,11 +292,11 @@ pub struct SpanData {
292292
pub user: Annotated<Value>,
293293

294294
/// Replay ID
295-
#[metastructure(field = "replay_id")]
295+
#[metastructure(field = "sentry.replay.id", legacy_alias = "replay_id")]
296296
pub replay_id: Annotated<Value>,
297297

298298
/// The sentry SDK (see [`crate::protocol::ClientSdkInfo`]).
299-
#[metastructure(field = "sdk.name")]
299+
#[metastructure(field = "sentry.sdk.name")]
300300
pub sdk_name: Annotated<String>,
301301

302302
/// Other fields in `span.data`.

relay-server/src/services/store.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,7 @@ struct SpanKafkaMessage<'a> {
13591359
event_id: Option<EventId>,
13601360
#[serde(rename(deserialize = "exclusive_time"))]
13611361
exclusive_time_ms: f64,
1362+
#[serde(default)]
13621363
is_segment: bool,
13631364

13641365
#[serde(borrow, default, skip_serializing_if = "Option::is_none")]

relay-spans/Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ chrono = { workspace = true }
1717
enumset = { workspace = true }
1818
hex = { workspace = true }
1919
once_cell = { workspace = true }
20-
opentelemetry-proto = { workspace = true, features = ["gen-tonic", "with-serde", "trace"] }
20+
opentelemetry-proto = { workspace = true, features = [
21+
"gen-tonic",
22+
"with-serde",
23+
"trace",
24+
] }
2125
relay-event-schema = { workspace = true }
2226
relay-protocol = { workspace = true }
2327
serde = { workspace = true }
2428
serde_json = { workspace = true }
2529
serde_repr = { workspace = true }
30+
31+
[dev-dependencies]
32+
insta = { workspace = true }

relay-spans/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ pub use crate::span::otel_to_sentry_span;
1010

1111
pub use opentelemetry_proto::tonic::trace::v1 as otel_trace;
1212

13-
mod otel_to_sentry_tags;
1413
mod span;
1514
mod status_codes;

relay-spans/src/otel_to_sentry_tags.rs

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)