diff --git a/snuba/manual_jobs/scrub_users_from_eap_spans.py b/snuba/manual_jobs/scrub_users_from_eap_spans.py index c2466d7710..043c85af54 100644 --- a/snuba/manual_jobs/scrub_users_from_eap_spans.py +++ b/snuba/manual_jobs/scrub_users_from_eap_spans.py @@ -29,14 +29,7 @@ def _get_query(self, cluster_name: str | None) -> str: on_cluster = f"ON CLUSTER '{cluster_name}'" if cluster_name else "" return f"""ALTER TABLE eap_spans_2_local {on_cluster} -UPDATE `attr_str_2` = mapApply((k, v) -> (k, if(k = 'user' AND startsWith(v, '{_IP_PREFIX}'), concat( - '{_IP_PREFIX}', - if( - isIPv4String(substring(v, 4)) OR isIPv6String(substring(v, 4)), - '{_SCRUBBED}', - substring(v, 4) - ) - ), v)), `attr_str_2`) +UPDATE `attr_str_2` = mapApply((k, v) -> (k, if(k = 'user' AND startsWith(v, '{_IP_PREFIX}') AND (isIPv4String(substring(v, 4)) OR isIPv6String(substring(v, 4))), 'ip:scrubbed', v)), `attr_str_2`) WHERE organization_id IN [{organization_ids}] AND _sort_timestamp >= toDateTime('{start_datetime}') AND _sort_timestamp < toDateTime('{end_datetime}')""" diff --git a/tests/manual_jobs/test_scrub_users_from_eap_spans.py b/tests/manual_jobs/test_scrub_users_from_eap_spans.py index 4b04ee06d9..82f78a630a 100644 --- a/tests/manual_jobs/test_scrub_users_from_eap_spans.py +++ b/tests/manual_jobs/test_scrub_users_from_eap_spans.py @@ -111,14 +111,7 @@ def test_generate_query() -> None: job._get_query(None) == """ALTER TABLE eap_spans_2_local -UPDATE `attr_str_2` = mapApply((k, v) -> (k, if(k = 'user' AND startsWith(v, 'ip:'), concat( - 'ip:', - if( - isIPv4String(substring(v, 4)) OR isIPv6String(substring(v, 4)), - 'scrubbed', - substring(v, 4) - ) - ), v)), `attr_str_2`) +UPDATE `attr_str_2` = mapApply((k, v) -> (k, if(k = 'user' AND startsWith(v, 'ip:') AND (isIPv4String(substring(v, 4)) OR isIPv6String(substring(v, 4))), 'ip:scrubbed', v)), `attr_str_2`) WHERE organization_id IN [1,3,5,6] AND _sort_timestamp >= toDateTime('2024-12-01T00:00:00') AND _sort_timestamp < toDateTime('2024-12-10T00:00:00')"""