PostHog / posthog-js-lite

Reimplementation of posthog-js to be as light and modular as possible.
https://posthog.com/docs/libraries
MIT License
69 stars 36 forks source link

feat: Sentry integration #141

Closed benjackwhite closed 10 months ago

benjackwhite commented 11 months ago

Clone of https://github.com/PostHog/posthog-js-lite/pull/120

Changes

Resolves #106 by porting the Sentry integration from posthog-js to posthog-js-lite. I have decided to port this for Node only for now, since I don’t think (??) posthog-js is in production yet. If we were to rely on a common core here some of the code would have to change.

I am also unsure of how this library wants to differ from posthog-js—the main edits I made were stylistic, and I tried to type everything a bit more strongly, which was the… vibe I’m getting from this repo? So I’m submitting this PR early and we can figure out what you actually want here (I also didn’t write tests). I will leave comments with questions.

Testing Strategy

I tested this manually by compiling the library & patching it into my own app. I tested that:

I am happy to write a test (how?) or test more extensively, wanted to wait until we had a more-reviewed PR before we do that.

(@benjackwhite - added tests)

Release info Sub-libraries affected

Bump level

Libraries affected

Changelog notes

Sentry.init({
     dsn: 'https://example',
     integrations: [
         new posthog.SentryIntegration(posthog)
     ]
})

Sentry.setTag(posthog.POSTHOG_ID_TAG, 'some distinct id');
huw commented 11 months ago

Easy, I’m following this one now

marandaneto commented 10 months ago

After this PR it'd be cool to have docs -> https://posthog.com/docs/libraries/node similar to https://posthog.com/docs/libraries/python#sentry so it's more discoverable.

benjackwhite commented 10 months ago

After this PR it'd be cool to have docs -> https://posthog.com/docs/libraries/node similar to https://posthog.com/docs/libraries/python#sentry so it's more discoverable.

Yep was just doing this :D