|
| 1 | +{ |
| 2 | + "body": { |
| 3 | + "api_key": "phc_snapshot_project", |
| 4 | + "batch": [ |
| 5 | + { |
| 6 | + "distinct_id": "user-123", |
| 7 | + "event": "$exception", |
| 8 | + "properties": { |
| 9 | + "$exception_list": [ |
| 10 | + { |
| 11 | + "mechanism": { |
| 12 | + "handled": true, |
| 13 | + "type": "generic" |
| 14 | + }, |
| 15 | + "module": null, |
| 16 | + "stacktrace": { |
| 17 | + "frames": [ |
| 18 | + { |
| 19 | + "abs_path": "<PROJECT_ROOT>/posthog/test/test_server_payload_snapshots.py", |
| 20 | + "context_line": " _raise_snapshot_exception()", |
| 21 | + "filename": "posthog/test/test_server_payload_snapshots.py", |
| 22 | + "function": "_exception_request", |
| 23 | + "in_app": true, |
| 24 | + "lineno": "<LINE_NUMBER>", |
| 25 | + "module": "posthog.test.test_server_payload_snapshots", |
| 26 | + "platform": "python", |
| 27 | + "post_context": [ |
| 28 | + " except RuntimeError as error:", |
| 29 | + " client.capture_exception(", |
| 30 | + " error,", |
| 31 | + " distinct_id=\"user-123\",", |
| 32 | + " properties={\"component\": \"checkout\", \"severity\": \"high\"}," |
| 33 | + ], |
| 34 | + "pre_context": [ |
| 35 | + " project_root=str(Path(__file__).parents[2]),", |
| 36 | + " capture_exception_code_variables=False,", |
| 37 | + " )", |
| 38 | + " try:", |
| 39 | + " try:" |
| 40 | + ] |
| 41 | + }, |
| 42 | + { |
| 43 | + "abs_path": "<PROJECT_ROOT>/posthog/test/test_server_payload_snapshots.py", |
| 44 | + "context_line": " raise RuntimeError(\"checkout failed\") from cause", |
| 45 | + "filename": "posthog/test/test_server_payload_snapshots.py", |
| 46 | + "function": "_raise_snapshot_exception", |
| 47 | + "in_app": true, |
| 48 | + "lineno": "<LINE_NUMBER>", |
| 49 | + "module": "posthog.test.test_server_payload_snapshots", |
| 50 | + "platform": "python", |
| 51 | + "post_context": [ |
| 52 | + "", |
| 53 | + "", |
| 54 | + "def _exception_request():", |
| 55 | + " session = mock.MagicMock()", |
| 56 | + " session.post.return_value = _successful_response()" |
| 57 | + ], |
| 58 | + "pre_context": [ |
| 59 | + "", |
| 60 | + "def _raise_snapshot_exception() -> None:", |
| 61 | + " try:", |
| 62 | + " raise ValueError(\"invalid order total\")", |
| 63 | + " except ValueError as cause:" |
| 64 | + ] |
| 65 | + } |
| 66 | + ], |
| 67 | + "type": "raw" |
| 68 | + }, |
| 69 | + "type": "RuntimeError", |
| 70 | + "value": "checkout failed" |
| 71 | + }, |
| 72 | + { |
| 73 | + "mechanism": { |
| 74 | + "handled": true, |
| 75 | + "type": "generic" |
| 76 | + }, |
| 77 | + "module": null, |
| 78 | + "stacktrace": { |
| 79 | + "frames": [ |
| 80 | + { |
| 81 | + "abs_path": "<PROJECT_ROOT>/posthog/test/test_server_payload_snapshots.py", |
| 82 | + "context_line": " raise ValueError(\"invalid order total\")", |
| 83 | + "filename": "posthog/test/test_server_payload_snapshots.py", |
| 84 | + "function": "_raise_snapshot_exception", |
| 85 | + "in_app": true, |
| 86 | + "lineno": "<LINE_NUMBER>", |
| 87 | + "module": "posthog.test.test_server_payload_snapshots", |
| 88 | + "platform": "python", |
| 89 | + "post_context": [ |
| 90 | + " except ValueError as cause:", |
| 91 | + " raise RuntimeError(\"checkout failed\") from cause", |
| 92 | + "", |
| 93 | + "", |
| 94 | + "def _exception_request():" |
| 95 | + ], |
| 96 | + "pre_context": [ |
| 97 | + " return _transport_request(session.post.call_args)", |
| 98 | + "", |
| 99 | + "", |
| 100 | + "def _raise_snapshot_exception() -> None:", |
| 101 | + " try:" |
| 102 | + ] |
| 103 | + } |
| 104 | + ], |
| 105 | + "type": "raw" |
| 106 | + }, |
| 107 | + "type": "ValueError", |
| 108 | + "value": "invalid order total" |
| 109 | + } |
| 110 | + ], |
| 111 | + "$geoip_disable": true, |
| 112 | + "$groups": { |
| 113 | + "company": "company-456" |
| 114 | + }, |
| 115 | + "$is_server": true, |
| 116 | + "$lib": "posthog-python", |
| 117 | + "$lib_version": "<SDK_VERSION>", |
| 118 | + "$os": "<OS>", |
| 119 | + "$os_distro": "<OS_DISTRO>", |
| 120 | + "$os_version": "<OS_VERSION>", |
| 121 | + "$python_runtime": "<PYTHON_RUNTIME>", |
| 122 | + "$python_version": "<PYTHON_VERSION>", |
| 123 | + "component": "checkout", |
| 124 | + "severity": "high" |
| 125 | + }, |
| 126 | + "timestamp": "2026-01-02T03:04:05+00:00", |
| 127 | + "uuid": "00000000-0000-4000-8000-000000000005" |
| 128 | + } |
| 129 | + ], |
| 130 | + "historical_migration": false, |
| 131 | + "sent_at": "2026-01-02T03:04:05+00:00" |
| 132 | + }, |
| 133 | + "headers": { |
| 134 | + "Content-Type": "application/json", |
| 135 | + "User-Agent": "posthog-python/<SDK_VERSION>" |
| 136 | + }, |
| 137 | + "timeout": 15, |
| 138 | + "url": "https://example.posthog.test/batch/" |
| 139 | +} |
0 commit comments