diff --git a/snuba/web/rpc/__init__.py b/snuba/web/rpc/__init__.py index 8218b0d1f4b..1cc42ce23c2 100644 --- a/snuba/web/rpc/__init__.py +++ b/snuba/web/rpc/__init__.py @@ -10,7 +10,7 @@ from google.protobuf.message import Message as ProtobufMessage from sentry_protos.snuba.v1.downsampled_storage_pb2 import DownsampledStorageConfig from sentry_protos.snuba.v1.error_pb2 import Error as ErrorProto -from sentry_protos.snuba.v1.request_common_pb2 import RequestMeta, TraceItemType +from sentry_protos.snuba.v1.request_common_pb2 import RequestMeta from sentry_sdk import traces from snuba import environment @@ -38,7 +38,6 @@ from snuba.web.rpc.common.query_info import extract_query_info_tags from snuba.web.rpc.storage_routing.routing_strategies.storage_routing import ( RoutingContext, - RoutingDecision, ) from snuba.web.rpc.storage_routing.routing_strategy_selector import ( RoutingStrategySelector, @@ -101,52 +100,6 @@ def _set_rpc_error_tags(in_msg: ProtobufMessage) -> None: set_tag_and_attribute("request_id", str(meta.request_id)) -class TraceItemDataResolver(Generic[Tin, Tout], metaclass=RegisteredClass): - def __init__( - self, timer: Timer | None = None, metrics_backend: MetricsBackend | None = None - ) -> None: - self._timer = timer or Timer("endpoint_timing") - self._metrics_backend = metrics_backend or environment.metrics - - @classmethod - def config_key(cls) -> str: - try: - trace_item_type = str(cls.trace_item_type()) - except NotImplementedError: - trace_item_type = "base" - return f"{cls.endpoint_name()}__{trace_item_type}" - - @classmethod - def endpoint_name(cls) -> str: - if cls.__name__ == "TraceItemDataResolver": - return cls.__name__ - raise NotImplementedError - - @classmethod - def trace_item_type(cls) -> TraceItemType.ValueType: - raise NotImplementedError - - @classmethod - def get_from_trace_item_type( - cls, - trace_item_type: TraceItemType.ValueType, - ) -> "type[TraceItemDataResolver[Tin, Tout]]": - registry = cls._registry - try: - shape = registry.get_class_from_name(f"{cls.endpoint_name()}__{trace_item_type}") - except InvalidConfigKeyError: - shape = registry.get_class_from_name( - f"{cls.endpoint_name()}__{TraceItemType.TRACE_ITEM_TYPE_UNSPECIFIED}" - ) - return cast( - type["TraceItemDataResolver[Tin, Tout]"], - shape, - ) - - def resolve(self, in_msg: Tin, routing_decision: RoutingDecision) -> Tout: - raise NotImplementedError - - class RPCEndpoint(Generic[Tin, Tout], metaclass=RegisteredClass): def __init__(self, metrics_backend: MetricsBackend | None = None) -> None: self._timer = Timer("endpoint_timing") @@ -168,11 +121,6 @@ def version(cls) -> str: def config_key(cls) -> str: return f"{cls.__name__}__{cls.version()}" - def get_resolver( - self, trace_item_type: TraceItemType.ValueType - ) -> TraceItemDataResolver[Tin, Tout]: - raise NotImplementedError - @property def metrics(self) -> MetricsWrapper: return MetricsWrapper( diff --git a/snuba/web/rpc/v1/resolvers/common/aggregation.py b/snuba/web/rpc/common/aggregation.py similarity index 100% rename from snuba/web/rpc/v1/resolvers/common/aggregation.py rename to snuba/web/rpc/common/aggregation.py diff --git a/snuba/web/rpc/v1/resolvers/common/cross_item_queries.py b/snuba/web/rpc/common/cross_item_queries.py similarity index 100% rename from snuba/web/rpc/v1/resolvers/common/cross_item_queries.py rename to snuba/web/rpc/common/cross_item_queries.py diff --git a/snuba/web/rpc/v1/resolvers/common/formula_reliability.py b/snuba/web/rpc/common/formula_reliability.py similarity index 98% rename from snuba/web/rpc/v1/resolvers/common/formula_reliability.py rename to snuba/web/rpc/common/formula_reliability.py index cdad64e4e44..02e26ce5892 100644 --- a/snuba/web/rpc/v1/resolvers/common/formula_reliability.py +++ b/snuba/web/rpc/common/formula_reliability.py @@ -6,7 +6,7 @@ from sentry_protos.snuba.v1.endpoint_time_series_pb2 import TimeSeriesRequest from sentry_protos.snuba.v1.trace_item_attribute_pb2 import Reliability -from snuba.web.rpc.v1.resolvers.common.aggregation import ExtrapolationContext +from snuba.web.rpc.common.aggregation import ExtrapolationContext from snuba.web.rpc.v1.visitors.time_series_request_visitor import ( GetSubformulaLabelsVisitor, ) diff --git a/snuba/web/rpc/v1/resolvers/common/trace_item_table.py b/snuba/web/rpc/common/trace_item_table.py similarity index 99% rename from snuba/web/rpc/v1/resolvers/common/trace_item_table.py rename to snuba/web/rpc/common/trace_item_table.py index 72d0230d081..83d75ed9e08 100644 --- a/snuba/web/rpc/v1/resolvers/common/trace_item_table.py +++ b/snuba/web/rpc/common/trace_item_table.py @@ -18,12 +18,12 @@ ) from snuba.protos.common import ARRAY_TYPES, PROTO_ARRAY_TYPE_TO_COLUMN +from snuba.web.rpc.common.aggregation import ( + ExtrapolationContext, +) from snuba.web.rpc.common.common import merge_typed_array_subcolumns from snuba.web.rpc.common.exceptions import BadSnubaRPCRequestException from snuba.web.rpc.v1.endpoint_get_trace import convert_to_attribute_value -from snuba.web.rpc.v1.resolvers.common.aggregation import ( - ExtrapolationContext, -) def _array_raw_to_attribute_value(raw: Any) -> AttributeValue: diff --git a/snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/__init__.py b/snuba/web/rpc/v1/co_occurring_attrs/__init__.py similarity index 79% rename from snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/__init__.py rename to snuba/web/rpc/v1/co_occurring_attrs/__init__.py index 9664993ac3a..d98d448cfce 100644 --- a/snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/__init__.py +++ b/snuba/web/rpc/v1/co_occurring_attrs/__init__.py @@ -9,21 +9,21 @@ ``for_request`` picks the source for a request. """ -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.base import ( +from snuba.web.rpc.v1.co_occurring_attrs.base import ( CoOccurringAttrsSource, ) -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.selection import ( +from snuba.web.rpc.v1.co_occurring_attrs.selection import ( CO_OCCURRING_ATTRS_V2_OPTION, CO_OCCURRING_ATTRS_V2_START_TIMESTAMP_DEFAULT, CO_OCCURRING_ATTRS_V2_START_TIMESTAMP_OPTION, for_request, ) -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.v1 import ( +from snuba.web.rpc.v1.co_occurring_attrs.v1 import ( CO_OCCURRING_ATTRS_STORAGE_KEY, V1, CoOccurringAttrsV1, ) -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.v2 import ( +from snuba.web.rpc.v1.co_occurring_attrs.v2 import ( CO_OCCURRING_ATTRS_V2_STORAGE_KEY, V2, CoOccurringAttrsV2, diff --git a/snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/base.py b/snuba/web/rpc/v1/co_occurring_attrs/base.py similarity index 100% rename from snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/base.py rename to snuba/web/rpc/v1/co_occurring_attrs/base.py diff --git a/snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/selection.py b/snuba/web/rpc/v1/co_occurring_attrs/selection.py similarity index 91% rename from snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/selection.py rename to snuba/web/rpc/v1/co_occurring_attrs/selection.py index ba46945d5a4..87555652712 100644 --- a/snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/selection.py +++ b/snuba/web/rpc/v1/co_occurring_attrs/selection.py @@ -10,11 +10,11 @@ from snuba.state.sentry_options import get_option from snuba.web.rpc.common.common import prev_monday -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.base import ( +from snuba.web.rpc.v1.co_occurring_attrs.base import ( CoOccurringAttrsSource, ) -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.v1 import V1 -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.v2 import V2 +from snuba.web.rpc.v1.co_occurring_attrs.v1 import V1 +from snuba.web.rpc.v1.co_occurring_attrs.v2 import V2 # Rollout flag. Not sufficient on its own: a request must also fall inside the window v2 has # data for, see for_request. diff --git a/snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/v1.py b/snuba/web/rpc/v1/co_occurring_attrs/v1.py similarity index 96% rename from snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/v1.py rename to snuba/web/rpc/v1/co_occurring_attrs/v1.py index ea6216fe56b..88da45a19ce 100644 --- a/snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/v1.py +++ b/snuba/web/rpc/v1/co_occurring_attrs/v1.py @@ -15,7 +15,7 @@ from snuba.datasets.storages.storage_key import StorageKey from snuba.query.dsl import Functions as f from snuba.query.expressions import Expression -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.base import ( +from snuba.web.rpc.v1.co_occurring_attrs.base import ( CoOccurringAttrsSource, ) diff --git a/snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/v2.py b/snuba/web/rpc/v1/co_occurring_attrs/v2.py similarity index 97% rename from snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/v2.py rename to snuba/web/rpc/v1/co_occurring_attrs/v2.py index 26e223c22aa..8c100e04561 100644 --- a/snuba/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/v2.py +++ b/snuba/web/rpc/v1/co_occurring_attrs/v2.py @@ -15,7 +15,7 @@ from snuba.query.dsl import Functions as f from snuba.query.dsl import column from snuba.query.expressions import Expression -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.base import ( +from snuba.web.rpc.v1.co_occurring_attrs.base import ( CoOccurringAttrsSource, ) diff --git a/snuba/web/rpc/v1/endpoint_get_traces.py b/snuba/web/rpc/v1/endpoint_get_traces.py index ff957612ace..23d105e3a1d 100644 --- a/snuba/web/rpc/v1/endpoint_get_traces.py +++ b/snuba/web/rpc/v1/endpoint_get_traces.py @@ -49,18 +49,18 @@ treeify_or_and_conditions, use_indexed_name_for_request, ) -from snuba.web.rpc.common.debug_info import ( - extract_response_meta, - setup_trace_query_settings, -) -from snuba.web.rpc.common.exceptions import BadSnubaRPCRequestException -from snuba.web.rpc.v1.resolvers.common.cross_item_queries import ( +from snuba.web.rpc.common.cross_item_queries import ( CROSS_ITEM_DISTRIBUTED_PRODUCT_MODE, convert_trace_filters_to_trace_item_filter_with_type, get_trace_ids_sql_for_cross_item_query, trace_id_in_subquery_condition, use_local_join_for_cross_item_queries, ) +from snuba.web.rpc.common.debug_info import ( + extract_response_meta, + setup_trace_query_settings, +) +from snuba.web.rpc.common.exceptions import BadSnubaRPCRequestException _DEFAULT_ROW_LIMIT = 10_000 _BUFFER_WINDOW = 2 * 3600 # 2 hours diff --git a/snuba/web/rpc/v1/endpoint_time_series.py b/snuba/web/rpc/v1/endpoint_time_series.py index bb816d0fb6d..76f7a3d338e 100644 --- a/snuba/web/rpc/v1/endpoint_time_series.py +++ b/snuba/web/rpc/v1/endpoint_time_series.py @@ -41,6 +41,13 @@ from snuba.utils.metrics.timer import Timer from snuba.web.query import run_query from snuba.web.rpc import RPCEndpoint +from snuba.web.rpc.common.aggregation import ( + ExtrapolationContext, + aggregation_to_expression, + get_average_sample_rate_column, + get_confidence_interval_column, + get_count_column, +) from snuba.web.rpc.common.common import ( add_existence_check_to_map_attribute_reads, attribute_key_to_expression, @@ -51,31 +58,24 @@ use_sampling_factor, valid_sampling_factor_conditions, ) +from snuba.web.rpc.common.cross_item_queries import ( + apply_cross_item_outer_query_settings, + get_trace_ids_sql_for_cross_item_query, + trace_id_in_subquery_condition, +) from snuba.web.rpc.common.debug_info import ( extract_response_meta, setup_trace_query_settings, ) from snuba.web.rpc.common.exceptions import BadSnubaRPCRequestException +from snuba.web.rpc.common.formula_reliability import ( + FormulaReliabilityCalculator, + _unix_seconds, +) from snuba.web.rpc.proto_visitor import ( AggregationToConditionalAggregationVisitor, TimeSeriesRequestWrapper, ) -from snuba.web.rpc.v1.resolvers.common.aggregation import ( - ExtrapolationContext, - aggregation_to_expression, - get_average_sample_rate_column, - get_confidence_interval_column, - get_count_column, -) -from snuba.web.rpc.v1.resolvers.common.cross_item_queries import ( - apply_cross_item_outer_query_settings, - get_trace_ids_sql_for_cross_item_query, - trace_id_in_subquery_condition, -) -from snuba.web.rpc.v1.resolvers.common.formula_reliability import ( - FormulaReliabilityCalculator, - _unix_seconds, -) from snuba.web.rpc.v1.visitors.time_series_request_visitor import ( preprocess_expression_labels, ) diff --git a/snuba/web/rpc/v1/endpoint_trace_item_attribute_names.py b/snuba/web/rpc/v1/endpoint_trace_item_attribute_names.py index d18dfbed285..622177a11a8 100644 --- a/snuba/web/rpc/v1/endpoint_trace_item_attribute_names.py +++ b/snuba/web/rpc/v1/endpoint_trace_item_attribute_names.py @@ -39,8 +39,8 @@ ) from snuba.web.rpc.common.debug_info import extract_response_meta from snuba.web.rpc.proto_visitor import ProtoVisitor, TraceItemFilterWrapper -from snuba.web.rpc.v1.resolvers.R_eap_items import co_occurring_attrs -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs import CoOccurringAttrsSource +from snuba.web.rpc.v1 import co_occurring_attrs +from snuba.web.rpc.v1.co_occurring_attrs import CoOccurringAttrsSource # max value the user can provide for 'limit' in their request MAX_REQUEST_LIMIT = 1000 @@ -270,7 +270,7 @@ def get_co_occurring_attributes( **Storage:** the roll-up this reads and the parts of the query shape that differ between the two (per-type key arrays, the aggregates) come from the `CoOccurringAttrsSource` - returned by `resolvers.R_eap_items.co_occurring_attrs.for_request`. + returned by `co_occurring_attrs.for_request`. **Explanation:** diff --git a/snuba/web/rpc/v1/endpoint_trace_item_stats.py b/snuba/web/rpc/v1/endpoint_trace_item_stats.py index 082eb3701e3..67fd0d80238 100644 --- a/snuba/web/rpc/v1/endpoint_trace_item_stats.py +++ b/snuba/web/rpc/v1/endpoint_trace_item_stats.py @@ -59,7 +59,7 @@ from snuba.web.rpc.storage_routing.routing_strategies.storage_routing import ( RoutingDecision, ) -from snuba.web.rpc.v1.resolvers.R_eap_items.heatmap_builder import HeatmapBuilder +from snuba.web.rpc.v1.heatmap_builder import HeatmapBuilder _DEFAULT_ROW_LIMIT = 10_000 diff --git a/snuba/web/rpc/v1/endpoint_trace_item_table.py b/snuba/web/rpc/v1/endpoint_trace_item_table.py index 0688e585776..9883205d352 100644 --- a/snuba/web/rpc/v1/endpoint_trace_item_table.py +++ b/snuba/web/rpc/v1/endpoint_trace_item_table.py @@ -62,6 +62,12 @@ from snuba.utils.metrics.timer import Timer from snuba.web.query import run_query from snuba.web.rpc import RPCEndpoint +from snuba.web.rpc.common.aggregation import ( + aggregation_to_expression, + get_average_sample_rate_column, + get_confidence_interval_column, + get_count_column, +) from snuba.web.rpc.common.common import ( add_existence_check_to_map_attribute_reads, attribute_key_to_expression, @@ -76,11 +82,17 @@ use_sampling_factor, valid_sampling_factor_conditions, ) +from snuba.web.rpc.common.cross_item_queries import ( + apply_cross_item_outer_query_settings, + get_trace_ids_sql_for_cross_item_query, + trace_id_in_subquery_condition, +) from snuba.web.rpc.common.debug_info import ( extract_response_meta, ) from snuba.web.rpc.common.exceptions import BadSnubaRPCRequestException from snuba.web.rpc.common.pagination import FlexibleTimeWindowPageWithFilters +from snuba.web.rpc.common.trace_item_table import convert_results from snuba.web.rpc.proto_visitor import ( AggregationToConditionalAggregationVisitor, ColumnWrapper, @@ -91,18 +103,6 @@ from snuba.web.rpc.storage_routing.routing_strategies.storage_routing import ( TimeWindow, ) -from snuba.web.rpc.v1.resolvers.common.aggregation import ( - aggregation_to_expression, - get_average_sample_rate_column, - get_confidence_interval_column, - get_count_column, -) -from snuba.web.rpc.v1.resolvers.common.cross_item_queries import ( - apply_cross_item_outer_query_settings, - get_trace_ids_sql_for_cross_item_query, - trace_id_in_subquery_condition, -) -from snuba.web.rpc.v1.resolvers.common.trace_item_table import convert_results from snuba.web.rpc.v1.visitors.sparse_aggregate_attribute_transformer import ( SparseAggregateAttributeTransformer, ) diff --git a/snuba/web/rpc/v1/resolvers/R_eap_items/heatmap_builder.py b/snuba/web/rpc/v1/heatmap_builder.py similarity index 100% rename from snuba/web/rpc/v1/resolvers/R_eap_items/heatmap_builder.py rename to snuba/web/rpc/v1/heatmap_builder.py diff --git a/snuba/web/rpc/v1/resolvers/__init__.py b/snuba/web/rpc/v1/resolvers/__init__.py deleted file mode 100644 index 63d8c24f160..00000000000 --- a/snuba/web/rpc/v1/resolvers/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -import os - -from snuba.utils.registered_class import import_submodules_in_directory - -_TO_IMPORT = {} - -for f in os.listdir(os.path.dirname(os.path.realpath(__file__))): - if f.startswith("R_"): - _TO_IMPORT[f] = os.path.join(os.path.dirname(os.path.realpath(__file__)), f) - - -for v, module_path in _TO_IMPORT.items(): - import_submodules_in_directory(module_path, f"snuba.web.rpc.v1.resolvers.{v}") diff --git a/snuba/web/rpc/v1/resolvers/common/__init__.py b/snuba/web/rpc/v1/resolvers/common/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/snuba/web/rpc/v1/trace_item_attribute_values.py b/snuba/web/rpc/v1/trace_item_attribute_values.py index e17c19348bf..d84c20666d8 100644 --- a/snuba/web/rpc/v1/trace_item_attribute_values.py +++ b/snuba/web/rpc/v1/trace_item_attribute_values.py @@ -39,10 +39,10 @@ treeify_or_and_conditions, ) from snuba.web.rpc.common.exceptions import BadSnubaRPCRequestException +from snuba.web.rpc.common.trace_item_table import get_converter_for_type from snuba.web.rpc.storage_routing.routing_strategies.storage_routing import ( RoutingDecision, ) -from snuba.web.rpc.v1.resolvers.common.trace_item_table import get_converter_for_type def _map_key_names_for_existence_check(request_key: AttributeKey) -> list[str]: diff --git a/tests/web/rpc/test_aggregation.py b/tests/web/rpc/test_aggregation.py index c0f25e46ee2..fabb8207467 100644 --- a/tests/web/rpc/test_aggregation.py +++ b/tests/web/rpc/test_aggregation.py @@ -22,12 +22,7 @@ Literal, SubscriptableReference, ) -from snuba.web.rpc.common.common import ( - attribute_key_to_expression, - get_field_existence_expression, -) -from snuba.web.rpc.common.exceptions import BadSnubaRPCRequestException -from snuba.web.rpc.v1.resolvers.common.aggregation import ( +from snuba.web.rpc.common.aggregation import ( CUSTOM_COLUMN_PREFIX, CustomColumnInformation, ExtrapolationContext, @@ -35,6 +30,11 @@ aggregation_to_expression, get_confidence_interval_column, ) +from snuba.web.rpc.common.common import ( + attribute_key_to_expression, + get_field_existence_expression, +) +from snuba.web.rpc.common.exceptions import BadSnubaRPCRequestException def _collect_column_names(expr: Expression) -> set[str]: diff --git a/tests/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/test_source_contract.py b/tests/web/rpc/v1/co_occurring_attrs/test_source_contract.py similarity index 96% rename from tests/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/test_source_contract.py rename to tests/web/rpc/v1/co_occurring_attrs/test_source_contract.py index a7dcc9137d0..b79e6c8ac1a 100644 --- a/tests/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/test_source_contract.py +++ b/tests/web/rpc/v1/co_occurring_attrs/test_source_contract.py @@ -9,8 +9,8 @@ from snuba.datasets.storages.factory import get_storage from snuba.query.expressions import FunctionCall -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs import V1, V2 -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.base import ( +from snuba.web.rpc.v1.co_occurring_attrs import V1, V2 +from snuba.web.rpc.v1.co_occurring_attrs.base import ( CoOccurringAttrsSource, ) diff --git a/tests/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/test_v1.py b/tests/web/rpc/v1/co_occurring_attrs/test_v1.py similarity index 97% rename from tests/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/test_v1.py rename to tests/web/rpc/v1/co_occurring_attrs/test_v1.py index 1420b647ab3..e6c1310d43b 100644 --- a/tests/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/test_v1.py +++ b/tests/web/rpc/v1/co_occurring_attrs/test_v1.py @@ -8,7 +8,7 @@ from sentry_protos.snuba.v1.trace_item_attribute_pb2 import AttributeKey from snuba.query.expressions import FunctionCall -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.v1 import ( +from snuba.web.rpc.v1.co_occurring_attrs.v1 import ( CO_OCCURRING_ATTRS_STORAGE_KEY, V1, ) diff --git a/tests/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/test_v2.py b/tests/web/rpc/v1/co_occurring_attrs/test_v2.py similarity index 98% rename from tests/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/test_v2.py rename to tests/web/rpc/v1/co_occurring_attrs/test_v2.py index b7e30164350..09253a163a5 100644 --- a/tests/web/rpc/v1/resolvers/R_eap_items/co_occurring_attrs/test_v2.py +++ b/tests/web/rpc/v1/co_occurring_attrs/test_v2.py @@ -8,7 +8,7 @@ from sentry_protos.snuba.v1.trace_item_attribute_pb2 import AttributeKey from snuba.query.expressions import Column, FunctionCall -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs.v2 import ( +from snuba.web.rpc.v1.co_occurring_attrs.v2 import ( CO_OCCURRING_ATTRS_V2_STORAGE_KEY, V2, ) diff --git a/tests/web/rpc/v1/test_cross_item_local_join.py b/tests/web/rpc/v1/test_cross_item_local_join.py index b3e7a96ca7b..01528153941 100644 --- a/tests/web/rpc/v1/test_cross_item_local_join.py +++ b/tests/web/rpc/v1/test_cross_item_local_join.py @@ -3,7 +3,7 @@ from snuba.downsampled_storage_tiers import Tier from snuba.query.expressions import Column, DangerousRawSQL from snuba.query.query_settings import HTTPQuerySettings -from snuba.web.rpc.v1.resolvers.common.cross_item_queries import ( +from snuba.web.rpc.common.cross_item_queries import ( CROSS_ITEM_DISTRIBUTED_PRODUCT_MODE, apply_cross_item_outer_query_settings, trace_id_in_subquery_condition, diff --git a/tests/web/rpc/v1/test_endpoint_trace_item_attribute_names.py b/tests/web/rpc/v1/test_endpoint_trace_item_attribute_names.py index ca41988c29b..ff7a6d5f7ed 100644 --- a/tests/web/rpc/v1/test_endpoint_trace_item_attribute_names.py +++ b/tests/web/rpc/v1/test_endpoint_trace_item_attribute_names.py @@ -17,14 +17,14 @@ from snuba.datasets.storages.factory import get_writable_storage from snuba.datasets.storages.storage_key import StorageKey from snuba.query.expressions import FunctionCall, Lambda, Literal +from snuba.web.rpc.v1.co_occurring_attrs import ( + CO_OCCURRING_ATTRS_V2_START_TIMESTAMP_OPTION, +) from snuba.web.rpc.v1.endpoint_trace_item_attribute_names import ( UNSEARCHABLE_ATTRIBUTE_KEYS, EndpointTraceItemAttributeNames, get_co_occurring_attributes, ) -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs import ( - CO_OCCURRING_ATTRS_V2_START_TIMESTAMP_OPTION, -) from tests.base import BaseApiTest from tests.helpers import write_raw_unprocessed_events from tests.web.rpc.v1.test_utils import gen_item_message diff --git a/tests/web/rpc/v1/test_endpoint_trace_item_attribute_names_v2.py b/tests/web/rpc/v1/test_endpoint_trace_item_attribute_names_v2.py index afca438cc81..0f914a05fd3 100644 --- a/tests/web/rpc/v1/test_endpoint_trace_item_attribute_names_v2.py +++ b/tests/web/rpc/v1/test_endpoint_trace_item_attribute_names_v2.py @@ -24,15 +24,15 @@ from snuba.datasets.storages.factory import get_storage, get_writable_storage from snuba.datasets.storages.storage_key import StorageKey from snuba.query.expressions import Column, FunctionCall +from snuba.web.rpc.v1 import co_occurring_attrs +from snuba.web.rpc.v1.co_occurring_attrs import ( + CO_OCCURRING_ATTRS_V2_START_TIMESTAMP_OPTION, + CO_OCCURRING_ATTRS_V2_STORAGE_KEY, +) from snuba.web.rpc.v1.endpoint_trace_item_attribute_names import ( EndpointTraceItemAttributeNames, get_co_occurring_attributes, ) -from snuba.web.rpc.v1.resolvers.R_eap_items import co_occurring_attrs -from snuba.web.rpc.v1.resolvers.R_eap_items.co_occurring_attrs import ( - CO_OCCURRING_ATTRS_V2_START_TIMESTAMP_OPTION, - CO_OCCURRING_ATTRS_V2_STORAGE_KEY, -) from tests.base import BaseApiTest from tests.helpers import write_raw_unprocessed_events from tests.web.rpc.v1.test_utils import gen_item_message diff --git a/tests/web/rpc/v1/test_endpoint_trace_item_stats_heatmap.py b/tests/web/rpc/v1/test_endpoint_trace_item_stats_heatmap.py index 7378215ebd6..34a8eb7feaa 100644 --- a/tests/web/rpc/v1/test_endpoint_trace_item_stats_heatmap.py +++ b/tests/web/rpc/v1/test_endpoint_trace_item_stats_heatmap.py @@ -23,7 +23,7 @@ from snuba.utils.metrics.timer import Timer from snuba.web.rpc.common.exceptions import BadSnubaRPCRequestException from snuba.web.rpc.v1.endpoint_trace_item_stats import EndpointTraceItemStats -from snuba.web.rpc.v1.resolvers.R_eap_items.heatmap_builder import HeatmapBuilder +from snuba.web.rpc.v1.heatmap_builder import HeatmapBuilder from tests.base import BaseApiTest from tests.helpers import write_raw_unprocessed_events from tests.web.rpc.v1.test_utils import ( diff --git a/tests/web/rpc/v1/test_endpoint_trace_item_table/test_endpoint_trace_item_table.py b/tests/web/rpc/v1/test_endpoint_trace_item_table/test_endpoint_trace_item_table.py index 4709d7004fe..521e54bd835 100644 --- a/tests/web/rpc/v1/test_endpoint_trace_item_table/test_endpoint_trace_item_table.py +++ b/tests/web/rpc/v1/test_endpoint_trace_item_table/test_endpoint_trace_item_table.py @@ -67,11 +67,13 @@ from snuba.query.expressions import Expression from snuba.web import QueryException from snuba.web.rpc import RPCEndpoint +from snuba.web.rpc.common.aggregation import aggregation_to_expression from snuba.web.rpc.common.common import attribute_key_to_expression from snuba.web.rpc.common.exceptions import ( BadSnubaRPCRequestException, QueryTimeoutException, ) +from snuba.web.rpc.common.trace_item_table import convert_results from snuba.web.rpc.proto_visitor import ( AggregationToConditionalAggregationVisitor, TraceItemTableRequestWrapper, @@ -84,8 +86,6 @@ _validate_select_and_groupby, build_query, ) -from snuba.web.rpc.v1.resolvers.common.aggregation import aggregation_to_expression -from snuba.web.rpc.v1.resolvers.common.trace_item_table import convert_results from tests.base import BaseApiTest from tests.helpers import write_raw_unprocessed_events from tests.web.rpc.v1.test_utils import (