From 39f72a0070cd826aca55a8abc6a0d67725a2086a Mon Sep 17 00:00:00 2001 From: David Newell Date: Thu, 24 Oct 2024 16:18:02 +0100 Subject: [PATCH] chore: add lang to frames (#139) --- CHANGELOG.md | 4 ++++ posthog/exception_utils.py | 1 + posthog/test/test_exception_capture.py | 4 ++-- posthog/version.py | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89a5230..3dc7976 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.7.1 - 2024-10-24 + +1. Add `platform` property to each frame of exception stacks. + ## 3.7.0 - 2024-10-03 1. Adds a new `super_properties` parameter on the client that are appended to every /capture call. diff --git a/posthog/exception_utils.py b/posthog/exception_utils.py index 95cd962..75282d1 100644 --- a/posthog/exception_utils.py +++ b/posthog/exception_utils.py @@ -369,6 +369,7 @@ def serialize_frame( tb_lineno = frame.f_lineno rv = { + "platform": "python", "filename": filename_for_module(module, abs_path) or None, "abs_path": os.path.abspath(abs_path) if abs_path else None, "function": function or "", diff --git a/posthog/test/test_exception_capture.py b/posthog/test/test_exception_capture.py index 6fffb1f..277da70 100644 --- a/posthog/test/test_exception_capture.py +++ b/posthog/test/test_exception_capture.py @@ -29,7 +29,7 @@ def test_excepthook(tmpdir): assert b"LOL" in output assert b"DEBUG:posthog:data uploaded successfully" in output assert ( - b'"$exception_list": [{"mechanism": {"type": "generic", "handled": true}, "module": null, "type": "ZeroDivisionError", "value": "division by zero", "stacktrace": {"frames": [{"filename": "app.py", "abs_path"' + b'"$exception_list": [{"mechanism": {"type": "generic", "handled": true}, "module": null, "type": "ZeroDivisionError", "value": "division by zero", "stacktrace": {"frames": [{"platform": "python", "filename": "app.py", "abs_path"' in output ) @@ -58,6 +58,6 @@ def test_trying_to_use_django_integration(tmpdir): assert b"LOL" in output assert b"DEBUG:posthog:data uploaded successfully" in output assert ( - b'"$exception_list": [{"mechanism": {"type": "generic", "handled": true}, "module": null, "type": "ZeroDivisionError", "value": "division by zero", "stacktrace": {"frames": [{"filename": "app.py", "abs_path"' + b'"$exception_list": [{"mechanism": {"type": "generic", "handled": true}, "module": null, "type": "ZeroDivisionError", "value": "division by zero", "stacktrace": {"frames": [{"platform": "python", "filename": "app.py", "abs_path"' in output ) diff --git a/posthog/version.py b/posthog/version.py index c8e28c6..5b234a8 100644 --- a/posthog/version.py +++ b/posthog/version.py @@ -1,4 +1,4 @@ -VERSION = "3.7.0" +VERSION = "3.7.1" if __name__ == "__main__": print(VERSION, end="") # noqa: T201