posthog-js icon indicating copy to clipboard operation
posthog-js copied to clipboard

Idea: ability to change PostHog URL for Sentry event tag

Open MrSaints opened this issue 3 years ago • 0 comments

When using the PostHog integration with Sentry, it automatically includes a tag with a link to the PostHog user, e.g. PostHog-URL: https://my-posthog.my-posthog.com/person/123abc.

The PostHog URL is based on the api_host, https://github.com/PostHog/posthog-js/blob/93cb611c2da6cbed0acd70465df0d7db4f75db0b/src/posthog-core.js#L1356

We run a slightly unique PostHog set-up in that we have two different routes (or rather, hostnames). A private PostHog hostname, and a public PostHog hostname. All paths in the former are only accessible internally, and in the latter, only ingestion paths are accessible externally. We could get into semantics of why this is the case (e.g. why not protect specific paths versus. whole hostnames), but frankly, the gist of it is that it is easier.

Because of this unique set-up, the PostHog-URL set in Sentry is the hostname of our public PostHog. I am wondering if we can consider allowing the base URL to be changed as part of the integration,

PostHogLib.prototype.sentry_integration = function (_posthog, organization, projectId, prefix) {

Or would that be unnecessary complexity?

MrSaints avatar Mar 22 '21 10:03 MrSaints