Skip to content

feat(spans): Align otel attributes with sentry span #3457

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

Merged
merged 28 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
12c5a46
feat(spans): Convert data fields
jjbayer Apr 17, 2024
b089c25
fix: parent span and is_segment condition
jjbayer Apr 18, 2024
0cfeb26
ref: dbg
jjbayer Apr 18, 2024
d429e7f
dbg again
jjbayer Apr 18, 2024
f9534d8
Merge remote-tracking branch 'origin/master' into feat/spans-more-fields
jjbayer Apr 18, 2024
0a12ca6
Type out span.data
jjbayer Apr 18, 2024
0ad1b78
test: update snapshot
jjbayer Apr 18, 2024
b409f25
feat(spans): Add more fields to span <-> transaction conversion
jjbayer Apr 18, 2024
c761aac
test
jjbayer Apr 18, 2024
d2ffc68
test
jjbayer Apr 18, 2024
14cfbdb
revert rename (will be follow up)
jjbayer Apr 18, 2024
b1bd53a
Merge remote-tracking branch 'origin/master' into feat/spans-more-fie…
jjbayer Apr 18, 2024
d03e861
test: update another snapshot
jjbayer Apr 18, 2024
1f71286
Merge branch 'feat/spans-more-fields-2' into feat/spans-otel-test
jjbayer Apr 18, 2024
bec1854
simplify
jjbayer Apr 18, 2024
ac94ab0
fix
jjbayer Apr 18, 2024
f9218a9
fix: transaction description
jjbayer Apr 18, 2024
3b1f4b4
fix: double write transaction
jjbayer Apr 18, 2024
bec3ac2
Restore order
jjbayer Apr 18, 2024
68b5278
Merge branch 'feat/spans-more-fields-2' into feat/spans-otel-test
jjbayer Apr 18, 2024
51c264b
Merge branch 'feat/spans-more-fields-2' into feat/spans-otel-test
jjbayer Apr 18, 2024
980b6d3
fix: Assume default, key name
jjbayer Apr 19, 2024
b33bacd
Merge remote-tracking branch 'origin/master' into feat/spans-otel-test
jjbayer Apr 22, 2024
e47a11f
Update relay-spans/src/span.rs
jjbayer Apr 22, 2024
3f6c1ed
doc: changelog
jjbayer Apr 22, 2024
c9c6dde
fix: merge
jjbayer Apr 22, 2024
97978ab
Merge branch 'master' into feat/spans-otel-test
jjbayer Apr 22, 2024
3c86837
Merge branch 'master' into feat/spans-otel-test
jjbayer Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

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

**Features**:

- Use same keys for OTel span attributes and Sentry span data. ([#3457](https://github.com/getsentry/relay/pull/3457))

**Internal**:

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

**Features**:

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

**Internal:**
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions relay-event-schema/src/protocol/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ pub struct SpanData {
pub db_system: Annotated<Value>,

/// The sentry environment.
#[metastructure(field = "environment")]
#[metastructure(field = "sentry.environment", legacy_alias = "environment")]
Copy link
Member Author

Choose a reason for hiding this comment

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

The disadvantage of this rename is that the new key will now be serialized into the payload. But span.data is not (yet) forwarded to sentry directly on standalone spans (we only extract some of it into sentry_tags, but that happens in relay). Spans as part of transactions are materialized into nodestore, but they don't rely on these particular span.data items AFAIK.

pub environment: Annotated<String>,

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

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

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

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

/// The sentry SDK (see [`crate::protocol::ClientSdkInfo`]).
#[metastructure(field = "sdk.name")]
#[metastructure(field = "sentry.sdk.name")]
Copy link
Member Author

Choose a reason for hiding this comment

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

No need for an alias here, this field was only introduced in #3456.

pub sdk_name: Annotated<String>,

/// Other fields in `span.data`.
Expand Down
1 change: 1 addition & 0 deletions relay-server/src/services/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,7 @@ struct SpanKafkaMessage<'a> {
event_id: Option<EventId>,
#[serde(rename(deserialize = "exclusive_time"))]
exclusive_time_ms: f64,
#[serde(default)]
is_segment: bool,
Copy link
Member Author

Choose a reason for hiding this comment

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

When we cannot derive is_segment, is should be set to false.


#[serde(borrow, default, skip_serializing_if = "Option::is_none")]
Expand Down
9 changes: 8 additions & 1 deletion relay-spans/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ chrono = { workspace = true }
enumset = { workspace = true }
hex = { workspace = true }
once_cell = { workspace = true }
opentelemetry-proto = { workspace = true, features = ["gen-tonic", "with-serde", "trace"] }
opentelemetry-proto = { workspace = true, features = [
"gen-tonic",
"with-serde",
"trace",
] }
relay-event-schema = { workspace = true }
relay-protocol = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_repr = { workspace = true }

[dev-dependencies]
insta = { workspace = true }
1 change: 0 additions & 1 deletion relay-spans/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ pub use crate::span::otel_to_sentry_span;

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

mod otel_to_sentry_tags;
mod span;
mod status_codes;
34 changes: 0 additions & 34 deletions relay-spans/src/otel_to_sentry_tags.rs

This file was deleted.

Loading