Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry integration documentation out of date #46

Open
lsmith77 opened this issue Dec 15, 2021 · 3 comments
Open

Sentry integration documentation out of date #46

lsmith77 opened this issue Dec 15, 2021 · 3 comments

Comments

@lsmith77
Copy link

lsmith77 commented Dec 15, 2021

These docs do not seem to be up to date:
https://posthog.com/docs/integrate/server/python#sentry

FYI I am looking to integrate PostHog with Sentry in a FastAPI project.

I guess the relevant bits can be found here https://github.com/PostHog/posthog-python/blob/master/sentry_django_example/sentry_django_example/settings.py#L44

Note its a bit inconvenient that one needs to configure the organization and project id, where Sentry expects the DSN.

@lsmith77
Copy link
Author

lsmith77 commented Jan 4, 2022

this is what my code looks like

import sentry_sdk
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
from posthog.sentry.posthog_integration import PostHogIntegration

# Sentry SDK set up with PostHog integration
def set_up_sentry_sdk(version, settings):
    integrations = [AioHttpIntegration()]

    PostHogIntegration.organization = settings.sentry_organization
    PostHogIntegration.project_id = settings.sentry_project_id

    integrations.append(PostHogIntegration())
    sentry_sdk.init(
        dsn=settings.sentry_dsn,
        traces_sample_rate=settings.sentry_traces_sample_rate,
        integrations=integrations,
        release=version,
        environment=settings.platform_environment,
    )

    return sentry_sdk

@lsmith77
Copy link
Author

lsmith77 commented Jan 4, 2022

@lsmith77
Copy link
Author

lsmith77 commented Jan 4, 2022

note when I throw an uncaught exception it gets logged properly on sentry but not on posthog.

also if I manually capture to posthog with the same settings, it also works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant