Browse Source

Revert "use subdivision field (#47866)"

This reverts commit d73dc487522cac270d05118c36f0500651198f32.

Co-authored-by: udameli <23648387+udameli@users.noreply.github.com>
getsentry-bot 1 year ago
parent
commit
bc8ab8ba82

+ 1 - 2
fixtures/events/performance_problems/db-on-main-thread.json

@@ -269,8 +269,7 @@
     "geo": {
       "country_code": "AT",
       "city": "Enns",
-      "region": "Austria",
-      "subvision": "Linz-Land"
+      "region": "Austria"
     }
   },
   "version": "7"

+ 1 - 2
fixtures/events/performance_problems/file-io-on-main-thread-with-complicated-structure.json

@@ -470,8 +470,7 @@
     "geo": {
       "country_code": "AT",
       "city": "Enns",
-      "region": "Austria",
-      "subvision": "Linz-Land"
+      "region": "Austria"
     }
   },
   "version": "7"

+ 1 - 2
fixtures/events/performance_problems/file-io-on-main-thread-with-obfuscation.json

@@ -288,8 +288,7 @@
     "geo": {
       "country_code": "AT",
       "city": "Hoersching",
-      "region": "Austria",
-      "subvision": "Linz-Land"
+      "region": "Austria"
     }
   },
   "version": "7"

+ 1 - 2
fixtures/events/performance_problems/file-io-on-main-thread-with-parallel-spans.json

@@ -322,8 +322,7 @@
     "geo": {
       "country_code": "AT",
       "city": "Enns",
-      "region": "Austria",
-      "subvision": "Linz-Land"
+      "region": "Austria"
     }
   },
   "version": "7"

+ 1 - 2
fixtures/events/performance_problems/file-io-on-main-thread.json

@@ -288,8 +288,7 @@
     "geo": {
       "country_code": "AT",
       "city": "Enns",
-      "region": "Austria",
-      "subvision": "Linz-Land"
+      "region": "Austria"
     }
   },
   "version": "7"

+ 0 - 2
src/sentry/interfaces/geo.py

@@ -11,7 +11,6 @@ class Geo(Interface):
     >>>     'country_code': 'US',
     >>>     'city': 'San Francisco',
     >>>     'region': 'CA',
-    >>>     'subdivision': 'California',
     >>> }
     """
 
@@ -21,7 +20,6 @@ class Geo(Interface):
             "country_code": data.get("country_code"),
             "city": data.get("city"),
             "region": data.get("region"),
-            "subdivision": data.get("subdivision"),
         }
 
         return super().to_python(data, **kwargs)

+ 0 - 1
src/sentry/issues/json_schemas.py

@@ -133,7 +133,6 @@ EVENT_PAYLOAD_SCHEMA: Mapping[str, Any] = {
                         "city": {"type": ["string", "null"], "minLength": 1},
                         "country_code": {"type": ["string", "null"], "minLength": 1},
                         "region": {"type": ["string", "null"], "minLength": 1},
-                        "subdivision": {"type": ["string", "null"], "minLength": 1},
                     },
                     "additionalProperties": False,
                 },

+ 0 - 1
src/sentry/models/userip.py

@@ -55,6 +55,5 @@ def _perform_log(user: User | RpcUser, ip_address: str):
     if geo:
         event.country_code = geo["country_code"]
         event.region_code = geo["region"]
-        event.subdivision = geo["subdivision"]
 
     log_service.record_user_ip(event=event)

+ 0 - 8
src/sentry/snuba/events.py

@@ -452,14 +452,6 @@ class Columns(Enum):
         issue_platform_name="contexts[geo.city]",
         alias="geo.city",
     )
-    GEO_SUBDIVISION = Column(
-        group_name="events.geo_subdivision",
-        event_name="geo_subdivision",
-        transaction_name="contexts[geo.subdivision]",
-        discover_name="geo_subdivision",
-        issue_platform_name="contexts[geo.subdivision]",
-        alias="geo.subdivision",
-    )
     ERROR_TYPE = Column(
         group_name="events.exception_stacks.type",
         event_name="exception_stacks.type",

+ 0 - 1
src/sentry/utils/geo.py

@@ -37,7 +37,6 @@ def _init_geoip():
             "country_code": geo["country"]["iso_code"],
             "region": geo.get("subdivisions", [{}])[-1].get("iso_code"),
             "city": geo.get("city", {}).get("names", {}).get("en"),
-            "subdivision": geo.get("subdivisions", [{}])[-1].get("names", {}).get("en"),
             "latitude": geo["location"]["latitude"],
             "longitude": geo["location"]["longitude"],
         }