Skip to content

Commit

Permalink
chore: sentry integration fixes (#1544)
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin authored Nov 22, 2024
1 parent d71ecd6 commit 9a05916
Showing 1 changed file with 5 additions and 20 deletions.
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

0 comments on commit 9a05916

Please sign in to comment.