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

chore: sentry integration fixes #1544

Merged
merged 4 commits into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions src/extensions/sentry-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @param {string} [organization] Optional: The Sentry organization, used to send a direct link from PostHog to Sentry
* @param {Number} [projectId] Optional: The Sentry project id, used to send a direct link from PostHog to Sentry
* @param {string} [prefix] Optional: Url of a self-hosted sentry instance (default: https://sentry.io/organizations/)
* @param {SeverityLevel[] | '*'} [severityAllowList] Optional: send events matching the provided levels. Use '*' to send all events (default: ['error'])
*/

import { PostHog } from '../posthog-core'
Expand All @@ -38,14 +39,14 @@ type _SentryException = any
type _SentryEventProcessor = any
type _SentryHub = any

interface _SentryIntegrationClass {
interface _SentryIntegration {
name: string
setupOnce(addGlobalEventProcessor: (callback: _SentryEventProcessor) => void, getCurrentHub: () => _SentryHub): void
processEvent(event: _SentryEvent): _SentryEvent
}

interface _SentryIntegration {
interface _SentryIntegrationClass {
name: string
processEvent(event: _SentryEvent): _SentryEvent
setupOnce(addGlobalEventProcessor: (callback: _SentryEventProcessor) => void, getCurrentHub: () => _SentryHub): void
}

interface SentryExceptionProperties {
Expand All @@ -61,13 +62,6 @@ export type SentryIntegrationOptions = {
organization?: string
projectId?: number
prefix?: string
/**
* By default, only errors are sent to PostHog. You can set this to '*' to send all events.
* Or to an error of SeverityLevel to only send events matching the provided levels.
* e.g. ['error', 'fatal'] to send only errors and fatals
* e.g. ['error'] to send only errors -- the default when omitted
* e.g. '*' to send all events
*/
severityAllowList?: SeverityLevel[] | '*'
}

Expand Down Expand Up @@ -107,7 +101,6 @@ export function createEventProcessor(
$exception_list: any
$exception_personURL: string
$exception_level: SeverityLevel
$level: SeverityLevel
} = {
// PostHog Exception Properties,
$exception_message: exceptions[0]?.value || event.message,
Expand All @@ -121,7 +114,6 @@ export function createEventProcessor(
$sentry_exception_message: exceptions[0]?.value || event.message,
$sentry_exception_type: exceptions[0]?.type,
$sentry_tags: event.tags,
$level: event.level,
}

if (organization && projectId) {
Expand Down Expand Up @@ -164,13 +156,6 @@ export class SentryIntegration implements _SentryIntegrationClass {
organization?: string,
projectId?: number,
prefix?: string,
/**
* By default, only errors are sent to PostHog. You can set this to '*' to send all events.
* Or to an error of SeverityLevel to only send events matching the provided levels.
* e.g. ['error', 'fatal'] to send only errors and fatals
* e.g. ['error'] to send only errors -- the default when omitted
* e.g. '*' to send all events
*/
severityAllowList?: SeverityLevel[] | '*'
) {
// setupOnce gets called by Sentry when it intializes the plugin
Expand Down
Loading