Skip to content

Commit 51ff62e

Browse files
nikkikapadiashashjar
authored andcommitted
fix(spans-migration): account for case sensitive boolean values (#102669)
i pushed a fix yesterday for the boolean filter logic but forgot to account for case insensitivity 🤦‍♀️ So i'm fixing that and planning to run the migration again with this new version.
1 parent 6b15175 commit 51ff62e

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

src/sentry/discover/translation/mep_to_eap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ def visit_boolean_filter(self, node, children):
239239

240240
flattened_parsed_val_num = None
241241
if negation == "":
242-
if flattened_parsed_val_str == "true":
242+
if flattened_parsed_val_str.lower() == "true":
243243
flattened_parsed_val_num = "1"
244-
elif flattened_parsed_val_str == "false":
244+
elif flattened_parsed_val_str.lower() == "false":
245245
flattened_parsed_val_num = "0"
246246
return f"(tags[{flattened_parsed_key_str},number]:{flattened_parsed_val_num if flattened_parsed_val_num is not None else flattened_parsed_val_str} OR {flattened_parsed_key_str}:{flattened_parsed_val_str})"
247247

src/sentry/explore/translation/dashboards_translation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def translate_dashboard_widget(widget: DashboardWidget) -> DashboardWidget:
189189
DashboardWidgetQuery.objects.bulk_create(new_widget_queries)
190190

191191
widget.widget_type = DashboardWidgetTypes.SPANS
192-
widget.dataset_source = DatasetSourcesTypes.SPAN_MIGRATION_VERSION_4.value
192+
widget.dataset_source = DatasetSourcesTypes.SPAN_MIGRATION_VERSION_5.value
193193
widget.changed_reason = dropped_fields_info
194194
widget.save()
195195

src/sentry/models/dashboard_widget.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ class DatasetSourcesTypes(Enum):
136136
Dataset modified by the transaction -> span migration version 4 (fixing boolean bug)
137137
"""
138138
SPAN_MIGRATION_VERSION_4 = 10
139+
"""
140+
Dataset modified by the transaction -> span migration version 5 (fixing boolean bug again)
141+
"""
142+
SPAN_MIGRATION_VERSION_5 = 11
139143

140144
@classmethod
141145
def as_choices(cls):

tests/sentry/explore/translation/test_dashboards_translation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_simple_case(self) -> None:
9696
# Assert widget type and dataset source are set correctly
9797
assert transaction_widget.widget_type == DashboardWidgetTypes.SPANS
9898
assert (
99-
transaction_widget.dataset_source == DatasetSourcesTypes.SPAN_MIGRATION_VERSION_4.value
99+
transaction_widget.dataset_source == DatasetSourcesTypes.SPAN_MIGRATION_VERSION_5.value
100100
)
101101

102102
assert not DashboardWidgetQuery.objects.filter(id=query.id).exists()
@@ -741,7 +741,7 @@ def test_simple_case_restore(self) -> None:
741741
# Verify translation occurred
742742
assert transaction_widget.widget_type == DashboardWidgetTypes.SPANS
743743
assert (
744-
transaction_widget.dataset_source == DatasetSourcesTypes.SPAN_MIGRATION_VERSION_4.value
744+
transaction_widget.dataset_source == DatasetSourcesTypes.SPAN_MIGRATION_VERSION_5.value
745745
)
746746
assert transaction_widget.widget_snapshot is not None
747747

0 commit comments

Comments
 (0)