diff --git a/posthog/api/insight.py b/posthog/api/insight.py index 36acef15acd09..7c15373d5c456 100644 --- a/posthog/api/insight.py +++ b/posthog/api/insight.py @@ -19,7 +19,6 @@ from rest_framework.response import Response from rest_framework.settings import api_settings from rest_framework_csv import renderers as csvrenderers -from sentry_sdk import capture_exception from posthog import schema from posthog.api.documentation import extend_schema @@ -813,12 +812,6 @@ def retrieve(self, request, *args, **kwargs): @action(methods=["GET", "POST"], detail=False) def trend(self, request: request.Request, *args: Any, **kwargs: Any): timings = HogQLTimings() - - try: - serializer = TrendSerializer(request=request) - serializer.is_valid(raise_exception=True) - except Exception as e: - capture_exception(e) try: with timings.measure("calculate"): result = self.calculate_trends(request) @@ -905,11 +898,6 @@ def calculate_trends(self, request: request.Request) -> Dict[str, Any]: @action(methods=["GET", "POST"], detail=False) def funnel(self, request: request.Request, *args: Any, **kwargs: Any) -> Response: timings = HogQLTimings() - try: - serializer = FunnelSerializer(request=request) - serializer.is_valid(raise_exception=True) - except Exception as e: - capture_exception(e) try: with timings.measure("calculate"): funnel = self.calculate_funnel(request) diff --git a/posthog/api/test/test_insight.py b/posthog/api/test/test_insight.py index 5710513597f6b..5089c774be1bd 100644 --- a/posthog/api/test/test_insight.py +++ b/posthog/api/test/test_insight.py @@ -1830,64 +1830,6 @@ def test_insight_trends_allowed_if_project_open_and_org_member(self) -> None: ) self.assertEqual(response.status_code, status.HTTP_200_OK) - @patch("posthog.api.insight.capture_exception") - def test_serializer(self, patch_capture_exception) -> None: - """ - Various regression tests for the serializer - """ - # Display - self.client.get( - f"/api/projects/{self.team.id}/insights/trend/?events={json.dumps([{'id': '$pageview'}])}&properties=%5B%5D&display=ActionsLineGraph" - ) - - self.assertEqual( - patch_capture_exception.call_count, - 0, - patch_capture_exception.call_args_list, - ) - - # Properties with an array - events = [ - { - "id": "$pageview", - "properties": [{"key": "something", "value": ["something"]}], - } - ] - self.client.get( - f"/api/projects/{self.team.id}/insights/trend/?events={json.dumps(events)}&properties=%5B%5D&display=ActionsLineGraph" - ) - self.assertEqual( - patch_capture_exception.call_count, - 0, - patch_capture_exception.call_args_list, - ) - - # Breakdown with ints in funnels - cohort_one_id = self._create_one_person_cohort([{"key": "prop", "value": 5, "type": "person"}]) - cohort_two_id = self._create_one_person_cohort([{"key": "prop", "value": 6, "type": "person"}]) - - events = [ - { - "id": "$pageview", - "properties": [{"key": "something", "value": ["something"]}], - }, - {"id": "$pageview"}, - ] - response = self.client.post( - f"/api/projects/{self.team.id}/insights/funnel/", - { - "events": events, - "breakdown": [cohort_one_id, cohort_two_id], - "breakdown_type": "cohort", - }, - ) - self.assertEqual(response.status_code, 200) - self.assertEqual( - patch_capture_exception.call_count, - 0, - patch_capture_exception.call_args_list, - ) - def _create_one_person_cohort(self, properties: List[Dict[str, Any]]) -> int: Person.objects.create(team=self.team, properties=properties) cohort_one_id = self.client.post(