Skip to content

Commit 579cc56

Browse files
authored
fix: delete sentry integration (#262)
* delete relevant files * bump uv lock, bump major version as deprecation * README.md * try mypy sync * Revert "try mypy sync" This reverts commit e1b98b2. * try looking at the github action
1 parent 3778eae commit 579cc56

File tree

18 files changed

+2072
-2469
lines changed

18 files changed

+2072
-2469
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 5.0.0
2+
3+
- fix: removed deprecated sentry integration
4+
15
## 4.10.0 - 2025-06-13
26

37
- fix: no longer fail in autocapture.

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,4 @@ release_analytics:
3535
e2e_test:
3636
.buildscripts/e2e.sh
3737

38-
django_example:
39-
python -m pip install -e ".[sentry]"
40-
cd sentry_django_example && python manage.py runserver 8080
41-
4238
.PHONY: test lint release e2e_test

README.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,6 @@ make test
4343

4444
Assuming you have a [local version of PostHog](https://posthog.com/docs/developing-locally) running, you can run `python3 example.py` to see the library in action.
4545

46-
### Running the Django Sentry Integration Locally
47-
48-
There's a sample Django project included, called `sentry_django_example`, which explains how to use PostHog with Sentry.
49-
50-
There's 2 places of importance (Changes required are all marked with TODO in the sample project directory)
51-
52-
1. Settings.py
53-
1. Input your Sentry DSN
54-
2. Input your Sentry Org and ProjectID details into `PosthogIntegration()`
55-
3. Add `POSTHOG_DJANGO` to settings.py. This allows the `PosthogDistinctIdMiddleware` to get the distinct_ids
56-
57-
2. urls.py
58-
1. This includes the `sentry-debug/` endpoint, which generates an exception
59-
60-
To run things: `make django_example`. This installs the posthog-python library with the sentry-sdk add-on, and then runs the django app.
61-
Also start the PostHog app locally.
62-
Then navigate to `http://127.0.0.1:8080/sentry-debug/` and you should get an event in both Sentry and PostHog, with links to each other.
63-
6446
### Releasing Versions
6547

66-
Updated are released using GitHub Actions: after bumping `version.py` in `master` and adding to `CHANGELOG.md`, go to [our release workflow's page](https://github.com/PostHog/posthog-python/actions/workflows/release.yaml) and dispatch it manually, using workflow from `master`.
48+
Updates are released using GitHub Actions: after bumping `version.py` in `master` and adding to `CHANGELOG.md`, go to [our release workflow's page](https://github.com/PostHog/posthog-python/actions/workflows/release.yaml) and dispatch it manually, using workflow from `master`.

mypy-baseline.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ posthog/__init__.py:0: note: "identify" defined here
3030
simulator.py:0: error: Unexpected keyword argument "traits" for "identify" [call-arg]
3131
posthog/__init__.py:0: note: "identify" defined here
3232
example.py:0: error: Statement is unreachable [unreachable]
33-
posthog/sentry/posthog_integration.py:0: error: Statement is unreachable [unreachable]
3433
posthog/ai/utils.py:0: error: Need type annotation for "output" (hint: "output: list[<type>] = ...") [var-annotated]
3534
posthog/ai/utils.py:0: error: Function "builtins.any" is not valid as a type [valid-type]
3635
posthog/ai/utils.py:0: note: Perhaps you meant "typing.Any" instead of "any"?
3736
posthog/ai/utils.py:0: error: Function "builtins.any" is not valid as a type [valid-type]
3837
posthog/ai/utils.py:0: note: Perhaps you meant "typing.Any" instead of "any"?
39-
sentry_django_example/sentry_django_example/settings.py:0: error: Need type annotation for "ALLOWED_HOSTS" (hint: "ALLOWED_HOSTS: list[<type>] = ...") [var-annotated]
40-
sentry_django_example/sentry_django_example/settings.py:0: error: Incompatible types in assignment (expression has type "str", variable has type "None") [assignment]

posthog/exception_utils.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
# "monitor_config": Mapping[str, object],
7676
"monitor_slug": Optional[str],
7777
"platform": Literal["python"],
78-
"profile": object, # Should be sentry_sdk.profiler.Profile, but we can't import that here due to circular imports
78+
"profile": object,
7979
"release": str,
8080
"request": Dict[str, object],
8181
# "sdk": Mapping[str, object],
@@ -136,9 +136,6 @@ def event_hint_with_exc_info(exc_info=None):
136136
class AnnotatedValue:
137137
"""
138138
Meta information for a data field in the event payload.
139-
This is to tell Relay that we have tampered with the fields value.
140-
See:
141-
https://github.com/getsentry/relay/blob/be12cd49a0f06ea932ed9b9f93a655de5d6ad6d1/relay-general/src/types/meta.rs#L407-L423
142139
"""
143140

144141
__slots__ = ("value", "metadata")
@@ -400,12 +397,7 @@ def serialize_frame(
400397
)
401398

402399
if include_local_variables:
403-
# TODO(nk): Sort out this current invalid import
404-
# from sentry_sdk.serializer import serialize
405-
406-
# rv["vars"] = serialize(
407-
# dict(frame.f_locals), is_vars=True, custom_repr=custom_repr
408-
# )
400+
# TODO - we don't support local variables, yet
409401
pass
410402

411403
return rv
@@ -464,10 +456,7 @@ def single_exception_from_error_tuple(
464456
):
465457
# type: (...) -> Dict[str, Any]
466458
"""
467-
Creates a dict that goes into the events `exception.values` list and is ingestible by Sentry.
468-
469-
See the Exception Interface documentation for more details:
470-
https://develop.sentry.dev/sdk/event-payloads/exception/
459+
Creates a dict that goes into the events `exception.values` list
471460
"""
472461
exception_value = {} # type: Dict[str, Any]
473462
exception_value["mechanism"] = (
@@ -591,9 +580,6 @@ def exceptions_from_error(
591580
"""
592581
Creates the list of exceptions.
593582
This can include chained exceptions and exceptions from an ExceptionGroup.
594-
595-
See the Exception Interface documentation for more details:
596-
https://develop.sentry.dev/sdk/event-payloads/exception/
597583
"""
598584

599585
parent = single_exception_from_error_tuple(

posthog/sentry/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

posthog/sentry/django.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

posthog/sentry/posthog_integration.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

posthog/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = "4.10.0"
1+
VERSION = "5.0.0"
22

33
if __name__ == "__main__":
44
print(VERSION, end="") # noqa: T201

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dynamic = ["version"]
88
description = "Integrate PostHog into any python application."
99
authors = [{ name = "PostHog", email = "[email protected]" }]
1010
maintainers = [{ name = "PostHog", email = "[email protected]" }]
11-
license = {text = "MIT"}
11+
license = { text = "MIT" }
1212
readme = "README.md"
1313
requires-python = ">=3.9"
1414
classifiers = [
@@ -36,7 +36,6 @@ Homepage = "https://github.com/posthog/posthog-python"
3636
Repository = "https://github.com/posthog/posthog-python"
3737

3838
[project.optional-dependencies]
39-
sentry = ["sentry-sdk", "django"]
4039
langchain = ["langchain>=0.2.0"]
4140
dev = [
4241
"django-stubs",
@@ -52,7 +51,7 @@ dev = [
5251
"pydantic",
5352
"ruff",
5453
"setuptools",
55-
"packaging",
54+
"packaging",
5655
"wheel",
5756
"twine",
5857
"tomli",
@@ -87,7 +86,6 @@ packages = [
8786
"posthog.ai.anthropic",
8887
"posthog.ai.gemini",
8988
"posthog.test",
90-
"posthog.sentry",
9189
"posthog.exception_integrations",
9290
]
9391

0 commit comments

Comments
 (0)