Skip to content

Commit f945f96

Browse files
xurui-cRachel Chen
and
Rachel Chen
authored
fix(eap-api): Sentry distinguishes floats and doubles (#83629)
Follow up on #83566 Even when Snuba sends back doubles, Sentry uses `TYPE_MAP` to resolve them into floats. This is unintended behavior. This PR makes it so that Sentry looks at Snuba's response to determine if the values are doubles, instead of looking at `TYPE_MAP` to determine that. Co-authored-by: Rachel Chen <[email protected]>
1 parent 4ef34ee commit f945f96

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

src/sentry/snuba/spans_rpc.py

+2-19
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,7 @@
1212
from sentry.api.event_search import SearchFilter, SearchKey, SearchValue
1313
from sentry.exceptions import InvalidSearchQuery
1414
from sentry.search.eap.columns import ResolvedColumn, ResolvedFunction
15-
from sentry.search.eap.constants import (
16-
BOOLEAN,
17-
DOUBLE,
18-
FLOAT,
19-
INT,
20-
MAX_ROLLUP_POINTS,
21-
STRING,
22-
VALID_GRANULARITIES,
23-
)
15+
from sentry.search.eap.constants import MAX_ROLLUP_POINTS, VALID_GRANULARITIES
2416
from sentry.search.eap.spans import SearchResolver
2517
from sentry.search.eap.types import CONFIDENCES, ConfidenceData, EAPResponse, SearchResolverConfig
2618
from sentry.search.events.fields import get_function_alias, is_function
@@ -138,16 +130,7 @@ def run_table_query(
138130

139131
for index, result in enumerate(column_value.results):
140132
result_value: str | int | float
141-
if resolved_column.proto_type == STRING:
142-
result_value = result.val_str
143-
elif resolved_column.proto_type == INT:
144-
result_value = result.val_int
145-
elif resolved_column.proto_type == FLOAT:
146-
result_value = result.val_float
147-
elif resolved_column.proto_type == DOUBLE:
148-
result_value = result.val_double
149-
elif resolved_column.proto_type == BOOLEAN:
150-
result_value = result.val_bool
133+
result_value = getattr(result, str(result.WhichOneof("value")))
151134
result_value = process_value(result_value)
152135
final_data[index][attribute] = resolved_column.process_column(result_value)
153136
if has_reliability:

0 commit comments

Comments
 (0)