From ecbd1210a43e9e8ac728a4f6cc68072cfb890014 Mon Sep 17 00:00:00 2001 From: ablaszkiewicz Date: Fri, 7 Nov 2025 16:09:23 +0100 Subject: [PATCH 1/2] fix: pass variables from init to client --- posthog/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/posthog/__init__.py b/posthog/__init__.py index 1879d10e..170a3180 100644 --- a/posthog/__init__.py +++ b/posthog/__init__.py @@ -14,6 +14,10 @@ set_code_variables_mask_patterns_context as inner_set_code_variables_mask_patterns_context, set_code_variables_ignore_patterns_context as inner_set_code_variables_ignore_patterns_context, ) +from posthog.exception_utils import ( + DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS, + DEFAULT_CODE_VARIABLES_MASK_PATTERNS, +) from posthog.feature_flags import InconclusiveMatchError, RequiresServerEvaluation from posthog.types import FeatureFlag, FlagsAndPayloads, FeatureFlagResult from posthog.version import VERSION @@ -177,6 +181,10 @@ def tag(name: str, value: Any): default_client = None # type: Optional[Client] +capture_exception_code_variables = False +code_variables_mask_patterns = DEFAULT_CODE_VARIABLES_MASK_PATTERNS +code_variables_ignore_patterns = DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS + # NOTE - this and following functions take unpacked kwargs because we needed to make # it impossible to write `posthog.capture(distinct-id, event-name)` - basically, to enforce @@ -771,6 +779,9 @@ def setup() -> Client: enable_exception_autocapture=enable_exception_autocapture, log_captured_exceptions=log_captured_exceptions, enable_local_evaluation=enable_local_evaluation, + capture_exception_code_variables=capture_exception_code_variables, + code_variables_mask_patterns=code_variables_mask_patterns, + code_variables_ignore_patterns=code_variables_ignore_patterns, ) # always set incase user changes it From fdef1d42cb9892e9c640b65278cb6c07a671eaef Mon Sep 17 00:00:00 2001 From: ablaszkiewicz Date: Fri, 7 Nov 2025 16:10:21 +0100 Subject: [PATCH 2/2] chore: version+changelog --- CHANGELOG.md | 4 ++++ posthog/version.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a1d48df..f73af971 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 6.9.1 - 2025-11-07 + +- fix(error-tracking): pass code variables config from init to client + # 6.9.0 - 2025-11-06 - feat(error-tracking): add local variables capture diff --git a/posthog/version.py b/posthog/version.py index c8d04581..94bfc721 100644 --- a/posthog/version.py +++ b/posthog/version.py @@ -1,4 +1,4 @@ -VERSION = "6.9.0" +VERSION = "6.9.1" if __name__ == "__main__": print(VERSION, end="") # noqa: T201