|
@@ -7,15 +7,8 @@ from sentry.search.events.fields import custom_time_processor
|
|
|
from sentry.search.events.types import SelectType
|
|
|
|
|
|
|
|
|
-class SpansIndexedQueryBuilder(QueryBuilder):
|
|
|
- requires_organization_condition = False
|
|
|
- uuid_fields = {"transaction.id", "replay.id", "profile.id", "trace"}
|
|
|
-
|
|
|
- def __init__(self, *args, **kwargs):
|
|
|
- super().__init__(*args, **kwargs)
|
|
|
- self.value_resolver_map[
|
|
|
- constants.SPAN_STATUS
|
|
|
- ] = lambda status: SPAN_STATUS_CODE_TO_NAME.get(status)
|
|
|
+class SpansIndexedQueryBuilderMixin:
|
|
|
+ meta_resolver_map: dict[str, str]
|
|
|
|
|
|
def get_field_type(self, field: str) -> str | None:
|
|
|
if field in self.meta_resolver_map:
|
|
@@ -26,7 +19,18 @@ class SpansIndexedQueryBuilder(QueryBuilder):
|
|
|
return None
|
|
|
|
|
|
|
|
|
-class TimeseriesSpanIndexedQueryBuilder(TimeseriesQueryBuilder):
|
|
|
+class SpansIndexedQueryBuilder(SpansIndexedQueryBuilderMixin, QueryBuilder):
|
|
|
+ requires_organization_condition = False
|
|
|
+ uuid_fields = {"transaction.id", "replay.id", "profile.id", "trace"}
|
|
|
+
|
|
|
+ def __init__(self, *args, **kwargs):
|
|
|
+ super().__init__(*args, **kwargs)
|
|
|
+ self.value_resolver_map[
|
|
|
+ constants.SPAN_STATUS
|
|
|
+ ] = lambda status: SPAN_STATUS_CODE_TO_NAME.get(status)
|
|
|
+
|
|
|
+
|
|
|
+class TimeseriesSpanIndexedQueryBuilder(SpansIndexedQueryBuilderMixin, TimeseriesQueryBuilder):
|
|
|
@property
|
|
|
def time_column(self) -> SelectType:
|
|
|
return custom_time_processor(
|
|
@@ -34,7 +38,7 @@ class TimeseriesSpanIndexedQueryBuilder(TimeseriesQueryBuilder):
|
|
|
)
|
|
|
|
|
|
|
|
|
-class TopEventsSpanIndexedQueryBuilder(TopEventsQueryBuilder):
|
|
|
+class TopEventsSpanIndexedQueryBuilder(SpansIndexedQueryBuilderMixin, TopEventsQueryBuilder):
|
|
|
@property
|
|
|
def time_column(self) -> SelectType:
|
|
|
return custom_time_processor(
|