Skip to content
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

chore(spans): Stop double writing tags to span.data #2598

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- Fix hot-loop burning CPU when upstream service is unavailable. ([#2518](https://github.com/getsentry/relay/pull/2518))
- Extract new low-cardinality transaction duration metric for statistical detectors. ([#2513](https://github.com/getsentry/relay/pull/2513))
- Introduce reservoir sampling rule. ([#2550](https://github.com/getsentry/relay/pull/2550))
- Write span tags to `span.sentry_tags`. ([#2555](https://github.com/getsentry/relay/pull/2555))
- Write span tags to `span.sentry_tags` instead of `span.data`. ([#2555](https://github.com/getsentry/relay/pull/2555), [#2598](https://github.com/getsentry/relay/pull/2598))
- Use JSON instead of MsgPack for Kafka spans. ([#2556](https://github.com/getsentry/relay/pull/2556))
- Add `profile_id` to spans. ([#2569](https://github.com/getsentry/relay/pull/2569))
- Introduce a dedicated usage metric for transactions that replaces the duration metric. ([#2571](https://github.com/getsentry/relay/pull/2571), [#2589](https://github.com/getsentry/relay/pull/2589))
Expand Down
43 changes: 0 additions & 43 deletions relay-event-normalization/src/normalize/span/tag_extraction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,38 +58,6 @@ pub enum SpanTagKey {
}

impl SpanTagKey {
/// The key used to write this tag into `span.data`.
///
/// This key corresponds to the tag key on span metrics.
/// NOTE: This method can be removed once we stop double-writing span tags.
pub fn data_key(&self) -> &str {
match self {
SpanTagKey::Release => "release",
SpanTagKey::User => "user",
SpanTagKey::Environment => "environment",
SpanTagKey::Transaction => "transaction",
SpanTagKey::TransactionMethod => "transaction.method",
SpanTagKey::TransactionOp => "transaction.op",
SpanTagKey::HttpStatusCode => "http.status_code",
SpanTagKey::Mobile => "mobile",
SpanTagKey::DeviceClass => "device.class",

SpanTagKey::Action => "span.action",
SpanTagKey::Category => "span.category",
SpanTagKey::Description => "span.description",
SpanTagKey::Domain => "span.domain",
SpanTagKey::Group => "span.group",
SpanTagKey::HttpDecodedResponseBodyLength => "http.decoded_response_body_length",
SpanTagKey::HttpResponseContentLength => "http.response_content_length",
SpanTagKey::HttpResponseTransferSize => "http.response_transfer_size",
SpanTagKey::Module => "span.module",
SpanTagKey::ResourceRenderBlockingStatus => "resource.render_blocking_status",
SpanTagKey::SpanOp => "span.op",
SpanTagKey::StatusCode => "span.status_code",
SpanTagKey::System => "span.system",
}
}

/// The key used to write this tag into `span.sentry_keys`.
///
/// This key corresponds to the tag key in the snuba span dataset.
Expand Down Expand Up @@ -183,17 +151,6 @@ pub(crate) fn extract_span_tags(event: &mut Event, config: &Config) {
.map(|(k, v)| (k.sentry_tag_key().to_owned(), Annotated::new(v)))
.collect(),
);

// Double write to `span.data` for now. This can be removed once all users of these fields
// have switched to `sentry_tags`.
let data = span.data.value_mut().get_or_insert_with(Default::default);
data.extend(
shared_tags
.clone()
.into_iter()
.chain(tags)
.map(|(k, v)| (k.data_key().to_owned(), Annotated::new(v.into()))),
);
}
}

Expand Down
12 changes: 0 additions & 12 deletions relay-server/src/actors/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2369,18 +2369,6 @@ impl EnvelopeProcessorService {
.map(|(k, v)| (k.sentry_tag_key().to_owned(), Annotated::new(v)))
.collect(),
);
// Double write to `span.data` for now. This can be removed once all users of these fields
// have switched to `sentry_tags`.
let data = transaction_span
.data
.value_mut()
.get_or_insert_with(Default::default);
data.extend(
shared_tags
.clone()
.into_iter()
.map(|(k, v)| (k.data_key().to_owned(), Annotated::new(v.into()))),
);
add_span(transaction_span.into());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,7 @@ expression: "(&event.value().unwrap().spans, metrics)"
tags: ~,
origin: ~,
profile_id: ~,
data: {
"device.class": String(
"1",
),
"mobile": String(
"true",
),
"release": String(
"1.2.3",
),
"span.op": String(
"default",
),
"transaction": String(
"gEt /api/:version/users/",
),
"transaction.method": String(
"GET",
),
},
data: ~,
sentry_tags: {
"device.class": "1",
"mobile": "true",
Expand Down
15 changes: 1 addition & 14 deletions tests/integration/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,16 +1230,7 @@ def test_spans(
"organization_id": 1,
"retention_days": 90,
"span": {
"data": {
"description.scrubbed": "GET *",
"span.category": "http",
"span.description": "GET *",
"span.group": "37e3d9fab1ae9162",
"span.module": "http",
"span.op": "http",
"transaction": "hi",
"transaction.op": "hi",
},
"data": {"description.scrubbed": "GET *"},
"description": "GET /api/0/organizations/?member=1",
"exclusive_time": 500.0,
"is_segment": False,
Expand Down Expand Up @@ -1270,10 +1261,6 @@ def test_spans(
"organization_id": 1,
"retention_days": 90,
"span": {
"data": {
"transaction": "hi",
"transaction.op": "hi",
},
"description": "hi",
"exclusive_time": 2000.0,
"is_segment": True,
Expand Down