Closed huw closed 11 months ago
This is great thank you! Happy to accept a PR for this.
Regarding where the user ID comes from, we have an integration in python as well where we add it as a middleware: https://github.com/PostHog/posthog-python/blob/master/posthog/sentry/posthog_integration.py#L25
I think as long as this integration has a mechanism for setting the id that's clearly explained & easy to setup, we're all good.
I love the PostHog Sentry integration on the client-side, so I rewrote it for
posthog-node
:I’d submit this as a PR, but it does have one small caveat—because
posthog-node
doesn’t store a persistentdistinctId
, we have to find it from somewhere. In my case, I keep thedistinctId
and the Sentryuser.id
in sync (withsentry.setUser({ id })
earlier in my code), but this obviously isn’t going to work for everyone. I am not entirely sure what a more robust solution would look like here, but it felt worth sharing what I had as a starting point.