Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ac63e1615 |
@@ -1,3 +1,7 @@
|
||||
# 7.4.2 - 2025-12-22
|
||||
|
||||
feat: add `in_app_modules` option to control code variables capturing
|
||||
|
||||
# 7.4.1 - 2025-12-19
|
||||
|
||||
fix: extract model from response for OpenAI stored prompts
|
||||
|
||||
+28
-7
@@ -1,25 +1,42 @@
|
||||
import datetime # noqa: F401
|
||||
from typing import Callable, Dict, Optional, Any # noqa: F401
|
||||
from typing import Any, Callable, Dict, Optional # noqa: F401
|
||||
|
||||
from typing_extensions import Unpack
|
||||
|
||||
from posthog.args import OptionalCaptureArgs, OptionalSetArgs, ExceptionArg
|
||||
from posthog.args import ExceptionArg, OptionalCaptureArgs, OptionalSetArgs
|
||||
from posthog.client import Client
|
||||
from posthog.contexts import (
|
||||
new_context as inner_new_context,
|
||||
scoped as inner_scoped,
|
||||
tag as inner_tag,
|
||||
set_context_session as inner_set_context_session,
|
||||
identify_context as inner_identify_context,
|
||||
)
|
||||
from posthog.contexts import (
|
||||
new_context as inner_new_context,
|
||||
)
|
||||
from posthog.contexts import (
|
||||
scoped as inner_scoped,
|
||||
)
|
||||
from posthog.contexts import (
|
||||
set_capture_exception_code_variables_context as inner_set_capture_exception_code_variables_context,
|
||||
set_code_variables_mask_patterns_context as inner_set_code_variables_mask_patterns_context,
|
||||
)
|
||||
from posthog.contexts import (
|
||||
set_code_variables_ignore_patterns_context as inner_set_code_variables_ignore_patterns_context,
|
||||
)
|
||||
from posthog.contexts import (
|
||||
set_code_variables_mask_patterns_context as inner_set_code_variables_mask_patterns_context,
|
||||
)
|
||||
from posthog.contexts import (
|
||||
set_context_session as inner_set_context_session,
|
||||
)
|
||||
from posthog.contexts import (
|
||||
tag as inner_tag,
|
||||
)
|
||||
from posthog.exception_utils import (
|
||||
DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS,
|
||||
DEFAULT_CODE_VARIABLES_MASK_PATTERNS,
|
||||
)
|
||||
from posthog.feature_flags import (
|
||||
InconclusiveMatchError as InconclusiveMatchError,
|
||||
)
|
||||
from posthog.feature_flags import (
|
||||
RequiresServerEvaluation as RequiresServerEvaluation,
|
||||
)
|
||||
from posthog.flag_definition_cache import (
|
||||
@@ -35,6 +52,8 @@ from posthog.request import (
|
||||
from posthog.types import (
|
||||
FeatureFlag,
|
||||
FlagsAndPayloads,
|
||||
)
|
||||
from posthog.types import (
|
||||
FeatureFlagResult as FeatureFlagResult,
|
||||
)
|
||||
from posthog.version import VERSION
|
||||
@@ -201,6 +220,7 @@ 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
|
||||
in_app_modules = None # type: Optional[list[str]]
|
||||
|
||||
|
||||
# NOTE - this and following functions take unpacked kwargs because we needed to make
|
||||
@@ -799,6 +819,7 @@ def setup() -> Client:
|
||||
capture_exception_code_variables=capture_exception_code_variables,
|
||||
code_variables_mask_patterns=code_variables_mask_patterns,
|
||||
code_variables_ignore_patterns=code_variables_ignore_patterns,
|
||||
in_app_modules=in_app_modules,
|
||||
)
|
||||
|
||||
# always set incase user changes it
|
||||
|
||||
+19
-16
@@ -5,24 +5,33 @@ import sys
|
||||
import warnings
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any, Dict, Optional, Union
|
||||
from typing_extensions import Unpack
|
||||
from uuid import uuid4
|
||||
|
||||
from dateutil.tz import tzutc
|
||||
from six import string_types
|
||||
from typing_extensions import Unpack
|
||||
|
||||
from posthog.args import OptionalCaptureArgs, OptionalSetArgs, ID_TYPES, ExceptionArg
|
||||
from posthog.args import ID_TYPES, ExceptionArg, OptionalCaptureArgs, OptionalSetArgs
|
||||
from posthog.consumer import Consumer
|
||||
from posthog.contexts import (
|
||||
_get_current_context,
|
||||
get_capture_exception_code_variables_context,
|
||||
get_code_variables_ignore_patterns_context,
|
||||
get_code_variables_mask_patterns_context,
|
||||
get_context_distinct_id,
|
||||
get_context_session_id,
|
||||
new_context,
|
||||
)
|
||||
from posthog.exception_capture import ExceptionCapture
|
||||
from posthog.exception_utils import (
|
||||
DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS,
|
||||
DEFAULT_CODE_VARIABLES_MASK_PATTERNS,
|
||||
exc_info_from_error,
|
||||
exception_is_already_captured,
|
||||
exceptions_from_error_tuple,
|
||||
handle_in_app,
|
||||
exception_is_already_captured,
|
||||
mark_exception_as_captured,
|
||||
try_attach_code_variables_to_frames,
|
||||
DEFAULT_CODE_VARIABLES_MASK_PATTERNS,
|
||||
DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS,
|
||||
)
|
||||
from posthog.feature_flags import (
|
||||
InconclusiveMatchError,
|
||||
@@ -46,15 +55,6 @@ from posthog.request import (
|
||||
get,
|
||||
remote_config,
|
||||
)
|
||||
from posthog.contexts import (
|
||||
_get_current_context,
|
||||
get_context_distinct_id,
|
||||
get_context_session_id,
|
||||
get_capture_exception_code_variables_context,
|
||||
get_code_variables_mask_patterns_context,
|
||||
get_code_variables_ignore_patterns_context,
|
||||
new_context,
|
||||
)
|
||||
from posthog.types import (
|
||||
FeatureFlag,
|
||||
FeatureFlagError,
|
||||
@@ -197,6 +197,7 @@ class Client(object):
|
||||
capture_exception_code_variables=False,
|
||||
code_variables_mask_patterns=None,
|
||||
code_variables_ignore_patterns=None,
|
||||
in_app_modules: list[str] | None = None,
|
||||
):
|
||||
"""
|
||||
Initialize a new PostHog client instance.
|
||||
@@ -265,6 +266,7 @@ class Client(object):
|
||||
if code_variables_ignore_patterns is not None
|
||||
else DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS
|
||||
)
|
||||
self.in_app_modules = in_app_modules
|
||||
|
||||
if project_root is None:
|
||||
try:
|
||||
@@ -998,6 +1000,7 @@ class Client(object):
|
||||
"values": all_exceptions_with_trace,
|
||||
},
|
||||
},
|
||||
in_app_include=self.in_app_modules,
|
||||
project_root=self.project_root,
|
||||
)
|
||||
all_exceptions_with_trace_and_in_app = event["exception"]["values"]
|
||||
@@ -2182,9 +2185,9 @@ class Client(object):
|
||||
return None
|
||||
|
||||
try:
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
from urllib.parse import parse_qs, urlparse
|
||||
except ImportError:
|
||||
from urlparse import urlparse, parse_qs
|
||||
from urlparse import parse_qs, urlparse
|
||||
|
||||
try:
|
||||
parsed = urlparse(cache_url)
|
||||
|
||||
@@ -14,23 +14,23 @@ import types
|
||||
from datetime import datetime
|
||||
from types import FrameType, TracebackType # noqa: F401
|
||||
from typing import ( # noqa: F401
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Literal,
|
||||
Optional,
|
||||
Pattern,
|
||||
Set,
|
||||
Tuple,
|
||||
TypedDict,
|
||||
TypeVar,
|
||||
Union,
|
||||
cast,
|
||||
TYPE_CHECKING,
|
||||
Pattern,
|
||||
)
|
||||
|
||||
from posthog.args import ExcInfo, ExceptionArg # noqa: F401
|
||||
from posthog.args import ExceptionArg, ExcInfo # noqa: F401
|
||||
|
||||
try:
|
||||
# Python 3.11
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
VERSION = "7.4.1"
|
||||
VERSION = "7.4.2"
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(VERSION, end="") # noqa: T201
|
||||
|
||||
Reference in New Issue
Block a user