Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
- Ports legacy standalone span processing to the processing framework. ([#5852](https://github.com/getsentry/relay/pull/5852))
- Retry failing objectstore requests. ([#5836](https://github.com/getsentry/relay/pull/5836))
- Add mobile normalizations to SpanV2 processing pipeline (mobile tag, main thread, outlier filtering, app start backfill from V1 transactions, device class). ([#5824](https://github.com/getsentry/relay/pull/5824))
<<<<<<< fix/performance-issues-span
- Make _performance_issues_spans a top-level field. ([#5870](https://github.com/getsentry/relay/pull/5870))
=======
- Remove the deprecated `aiModelCosts` global config, superseded by `aiModelMetadata`. ([#5862](https://github.com/getsentry/relay/pull/5862))
>>>>>>> master
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated

**Bug Fixes**:

Expand Down
13 changes: 13 additions & 0 deletions relay-event-schema/src/protocol/span_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ pub struct SpanV2 {
#[metastructure(pii = "true", trim = true)]
pub attributes: Annotated<Attributes>,

/// Temporary flag that controls where performance issues are detected.
///
/// When the flag is set to true, performance issues will be detected on this span provided it
/// is a root (segment) instead of the transaction event.
///
/// Only set on root spans extracted from transactions.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
/// When the flag is set to true, performance issues will be detected on this span provided it
/// is a root (segment) instead of the transaction event.
///
/// Only set on root spans extracted from transactions.
/// By default, performance issues are detected on transactions. When this flag is
/// `true` and the span is a segment (root) span, detection runs on this span instead — this
/// lets Sentry migrate detection from the legacy transaction-event pipeline to the new
/// standalone-spans (EAP) pipeline without double-reporting issues.
///
/// This flag is only meaningful on segment (root) spans that originated from a transaction event.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Found the original phrasing ambiguous, but maybe I just lack context

#[metastructure(
field = "_performance_issues_spans",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should a top level field be underscored?

skip_serialization = "empty",
trim = false
)]
pub performance_issues_spans: Annotated<bool>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does this need to be top level and not an attribute (what it already is)? Can we instead change the consumer code?

I feel like this may set a bad precedent where we start adding things top level.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It can be. Then we need to define it in conventions and adjust the consuming code accordingly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's using an _internal attribute right now, we decided not to define these in conventions.

That being said, _internal is also not the best option here, but I think it's fine if we tackle this separately (or not at all considering there is a plan to remove it alltogether)


/// Additional arbitrary fields for forwards compatibility.
#[metastructure(additional_properties, pii = "maybe")]
pub other: Object<Value>,
Expand Down
10 changes: 2 additions & 8 deletions relay-spans/src/v1_to_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ pub fn span_v1_to_span_v2(span_v1: SpanV1) -> SpanV2 {
attributes.insert("sentry.profile_id", profile_id.map_value(|v| v.to_string()));
attributes.insert("sentry.platform", platform);
attributes.insert("sentry.was_transaction", was_transaction);
attributes.insert(
"sentry._internal.performance_issues_spans",
performance_issues_spans,
);

// Use same precedence as `backfill_data` for data bags:
if let Some(measurements) = measurements.into_value() {
Expand Down Expand Up @@ -130,6 +126,7 @@ pub fn span_v1_to_span_v2(span_v1: SpanV1) -> SpanV2 {
end_timestamp: timestamp,
links: links.map_value(span_v1_links_to_span_v2_links),
attributes: annotated_attributes,
performance_issues_spans,
other: Default::default(), // cannot carry over because of schema mismatch
}
}
Expand Down Expand Up @@ -371,10 +368,6 @@ mod tests {
"type": "string",
"value": "{\"numbers\":[1,2,3]}"
},
"sentry._internal.performance_issues_spans": {
"type": "boolean",
"value": true
},
"sentry.client_sample_rate": {
"type": "double",
"value": 0.11
Expand Down Expand Up @@ -432,6 +425,7 @@ mod tests {
"value": true
}
},
"_performance_issues_spans": true,
"_meta": {
"attributes": {
"my.array": {
Expand Down
7 changes: 1 addition & 6 deletions tests/integration/test_spans.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,7 @@ def test_span_extraction(
del transaction_span["received"]

if performance_issues_spans:
assert (
transaction_span["attributes"].pop(
"sentry._internal.performance_issues_spans"
)["value"]
is True
)
assert transaction_span.pop("_performance_issues_spans") is True

expected_transaction_span = {
"attributes": {
Expand Down
Loading