Skip to content

Commit 0901942

Browse files
committed
ref: Change imports for upcoming sentry-kafka-schemas release
1 parent 30f1b9c commit 0901942

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
from collections import defaultdict
22
from typing import Any, cast
33

4-
# TODO(ja): Fix and update the schema
5-
from sentry_kafka_schemas.schema_types.buffered_segments_v1 import _MeasurementValue
6-
74
from sentry.models.project import Project
8-
from sentry.spans.consumers.process_segments.types import Span
5+
from sentry.spans.consumers.process_segments.types import MeasurementValue, Span
96

107
# Keys in `sentry_tags` that are shared across all spans in a segment. This list
118
# is taken from `extract_shared_tags` in Relay.
@@ -195,7 +192,7 @@ def compute_breakdowns(segment: Span, spans: list[Span], project: Project) -> No
195192
measurements[f"{breakdown_name}.{key}"] = value
196193

197194

198-
def _compute_span_ops(spans: list[Span], config: Any) -> dict[str, _MeasurementValue]:
195+
def _compute_span_ops(spans: list[Span], config: Any) -> dict[str, MeasurementValue]:
199196
matches = config.get("matches")
200197
if not matches:
201198
return {}
@@ -206,7 +203,7 @@ def _compute_span_ops(spans: list[Span], config: Any) -> dict[str, _MeasurementV
206203
if operation_name := next(filter(lambda m: op.startswith(m), matches), None):
207204
intervals_by_op[operation_name].append(_span_interval(span))
208205

209-
measurements: dict[str, _MeasurementValue] = {}
206+
measurements: dict[str, MeasurementValue] = {}
210207
for operation_name, intervals in intervals_by_op.items():
211208
duration = _get_duration_us(intervals)
212209
measurements[f"ops.{operation_name}"] = {"value": duration / 1000, "unit": "millisecond"}

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
from typing import Any, NotRequired
1+
from typing import NotRequired
22

3+
from sentry_kafka_schemas.schema_types.buffered_segments_v1 import MeasurementValue
34
from sentry_kafka_schemas.schema_types.buffered_segments_v1 import SegmentSpan as UnprocessedSpan
45

56
__all__ = (
7+
"MeasurementValue",
68
"Span",
79
"UnprocessedSpan",
810
)
@@ -14,11 +16,6 @@ class Span(UnprocessedSpan, total=True):
1416
extracted.
1517
"""
1618

17-
# Missing in schema
18-
start_timestamp_precise: float
19-
end_timestamp_precise: float
20-
data: NotRequired[dict[str, Any]] # currently unused
21-
2219
# Added in enrichment
2320
exclusive_time: float
2421
exclusive_time_ms: float

0 commit comments

Comments
 (0)