Skip to content

Commit cf92fb6

Browse files
Rachel ChenRachel Chen
authored andcommitted
c
almost done get rid of some stuff clean item id item id page token done? pagination cleanup cleanup pagination strings remove comment index optimize idk smth up with item_id fixed cleanup c
1 parent 81621c8 commit cf92fb6

File tree

8 files changed

+597
-31
lines changed

8 files changed

+597
-31
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies = [
3131
"sentry-arroyo>=2.35.0",
3232
"sentry-conventions>=0.3.0",
3333
"sentry-kafka-schemas>=2.1.2",
34-
"sentry-protos>=0.4.8",
34+
"sentry-protos>=0.4.9",
3535
"sentry-redis-tools>=0.5.1",
3636
"sentry-relay>=0.9.19",
3737
"sentry-sdk>=2.35.0",

snuba/web/rpc/common/common.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import json
12
from datetime import datetime, timedelta, timezone
2-
from typing import Callable, TypeVar, cast
3+
from typing import Any, Callable, TypeVar, cast
34

45
from google.protobuf.message import Message as ProtobufMessage
56
from sentry_protos.snuba.v1.request_common_pb2 import RequestMeta
@@ -49,6 +50,27 @@ def attribute_key_to_expression(attr_key: AttributeKey) -> Expression:
4950
Tin = TypeVar("Tin", bound=ProtobufMessage)
5051
Tout = TypeVar("Tout", bound=ProtobufMessage)
5152

53+
BUCKET_COUNT = 40
54+
55+
56+
def transform_array_value(value: dict[str, str]) -> Any:
57+
for t, v in value.items():
58+
if t == "Int":
59+
return int(v)
60+
if t == "Double":
61+
return float(v)
62+
if t in {"String", "Bool"}:
63+
return v
64+
raise BadSnubaRPCRequestException(f"array value type unknown: {type(v)}")
65+
66+
67+
def process_arrays(raw: str) -> dict[str, list[Any]]:
68+
parsed = json.loads(raw) or {}
69+
arrays = {}
70+
for key, values in parsed.items():
71+
arrays[key] = [transform_array_value(v) for v in values]
72+
return arrays
73+
5274

5375
def _check_non_string_values_cannot_ignore_case(
5476
comparison_filter: ComparisonFilter,

0 commit comments

Comments
 (0)