Skip to content

Commit

Permalink
chore: sentry integration fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin committed Nov 20, 2024
1 parent d71ecd6 commit daec91d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"@rrweb/record": "2.0.0-alpha.17",
"@rrweb/rrweb-plugin-console-record": "2.0.0-alpha.17",
"@rrweb/types": "2.0.0-alpha.17",
"@sentry/types": "8.7.0",
"@testing-library/dom": "^9.3.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/preact": "^3.2.4",
Expand Down
3 changes: 0 additions & 3 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,5 @@
"setupFilesAfterEnv": [
"given2/setup"
]
},
"dependencies": {
"@sentry/types": "7.37.2"
}
}
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 daec91d

Please sign in to comment.