Skip to content

Commit 7be5e5e

Browse files
committed
attributes[sentry.is_segment] -> is_segment
1 parent 9e801a9 commit 7be5e5e

File tree

7 files changed

+5
-9
lines changed

7 files changed

+5
-9
lines changed

src/sentry/spans/buffer.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,7 @@ def flush_segments(self, now: int) -> dict[SegmentKey, FlushedSegment]:
438438
}
439439

440440
is_segment = segment_span_id == span["span_id"]
441-
span.setdefault("attributes", {})["sentry.is_segment"] = {
442-
"type": "boolean",
443-
"value": is_segment,
444-
}
441+
span["is_segment"] = is_segment
445442
if is_segment:
446443
has_root_span = True
447444

src/sentry/spans/consumers/process_segments/convert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"hash": "sentry.hash",
1818
# TODO(INGEST-612): Remove "is_remote" once Relay writes this attribute.
1919
"is_remote": "sentry.is_remote",
20+
"is_segment": "sentry.is_segment",
2021
"kind": "sentry.kind",
2122
"name": "sentry.name",
2223
"parent_span_id": "sentry.parent_span_id",

src/sentry/spans/consumers/process_segments/enrichment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _find_segment_span(spans: list[SpanEvent]) -> SpanEvent | None:
6060

6161
# Iterate backwards since we usually expect the segment span to be at the end.
6262
for span in reversed(spans):
63-
if attribute_value(span, "sentry.is_segment"):
63+
if span.get("is_segment"):
6464
return span
6565

6666
return None

src/sentry/spans/consumers/process_segments/shim.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def make_compatible(span: SpanEvent) -> CompatibleSpan:
3333
"sentry_tags": _sentry_tags(span.get("attributes") or {}),
3434
"op": get_span_op(span),
3535
"exclusive_time": attribute_value(span, "sentry.exclusive_time_ms"),
36-
"is_segment": bool(attribute_value(span, "sentry.is_segment")),
3736
}
3837

3938
return ret

src/sentry/spans/consumers/process_segments/types.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class CompatibleSpan(SpanEvent, total=True):
3131
exclusive_time: float
3232
op: str
3333
sentry_tags: dict[str, str]
34-
is_segment: bool
3534

3635
# Added by `SpanGroupingResults.write_to_spans` in `_enrich_spans`
3736
hash: NotRequired[str]

src/sentry/spans/grouping/strategy/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_standalone_span_group(self, span: Span) -> str:
5757
# compatibility with transaction events, but fall back to default
5858
# fingerprinting if the span doesn't have a transaction.
5959
if (
60-
attribute_value(span, "sentry.is_segment")
60+
span.get("is_segment")
6161
and (transaction := attribute_value(span, "sentry.transaction")) is not None
6262
):
6363
result = Hash()

tests/sentry/spans/consumers/process/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def build_mock_span(project_id, *, span_op=None, is_segment=False, attributes=None, **kwargs):
55
span: SpanEvent = {
6-
"is_segment": is_segment,
6+
"is_remote": is_segment,
77
"parent_span_id": None,
88
"project_id": project_id,
99
"organization_id": 1,

0 commit comments

Comments
 (0)