From daec91dfebdeef2bdf4eca69488e2b7ab17b0030 Mon Sep 17 00:00:00 2001 From: David Newell Date: Wed, 20 Nov 2024 19:39:50 +0000 Subject: [PATCH 1/4] chore: sentry integration fixes --- package.json | 1 - react/package.json | 3 --- src/extensions/sentry-integration.ts | 25 +++++-------------------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 8b5e20c78..a35aef3b5 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/react/package.json b/react/package.json index 5c2d90420..3daebebd7 100644 --- a/react/package.json +++ b/react/package.json @@ -65,8 +65,5 @@ "setupFilesAfterEnv": [ "given2/setup" ] - }, - "dependencies": { - "@sentry/types": "7.37.2" } } diff --git a/src/extensions/sentry-integration.ts b/src/extensions/sentry-integration.ts index 940655dd0..2e14db7d1 100644 --- a/src/extensions/sentry-integration.ts +++ b/src/extensions/sentry-integration.ts @@ -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' @@ -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 { @@ -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[] | '*' } @@ -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, @@ -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) { @@ -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 From e0d2dd8c9a8c07d9e9eb54e2861444c78567c9ce Mon Sep 17 00:00:00 2001 From: David Newell Date: Wed, 20 Nov 2024 20:08:41 +0000 Subject: [PATCH 2/4] remove package --- pnpm-lock.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c0a2b7098..fb1e43f2d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -81,9 +81,6 @@ devDependencies: '@rrweb/types': specifier: 2.0.0-alpha.17 version: 2.0.0-alpha.17 - '@sentry/types': - specifier: 8.7.0 - version: 8.7.0 '@testing-library/dom': specifier: ^9.3.0 version: 9.3.0 @@ -2897,11 +2894,6 @@ packages: resolution: {integrity: sha512-HCsasPERBwOS9/LQeOytO2ETKTCqRj1wORBuxiy3t41hKhmi225DdrUPiWnyDdTQm1GdVbOymMRknJVPnZaSXw==} dev: true - /@sentry/types@8.7.0: - resolution: {integrity: sha512-11KLOKumP6akugVGLvSoEig+JlP0ZEzW3nN9P+ppgdIx9HAxMIh6UvumbieG4/DWjAh2kh6NPNfUw3gk2Gfq1A==} - engines: {node: '>=14.18'} - dev: true - /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true From bc81a3a55be9145572193e201e8570bab7f8d45c Mon Sep 17 00:00:00 2001 From: David Newell Date: Fri, 22 Nov 2024 09:38:33 +0000 Subject: [PATCH 3/4] add types back --- package.json | 1 + pnpm-lock.yaml | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/package.json b/package.json index a35aef3b5..8b5e20c78 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "@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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fb1e43f2d..c0a2b7098 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -81,6 +81,9 @@ devDependencies: '@rrweb/types': specifier: 2.0.0-alpha.17 version: 2.0.0-alpha.17 + '@sentry/types': + specifier: 8.7.0 + version: 8.7.0 '@testing-library/dom': specifier: ^9.3.0 version: 9.3.0 @@ -2894,6 +2897,11 @@ packages: resolution: {integrity: sha512-HCsasPERBwOS9/LQeOytO2ETKTCqRj1wORBuxiy3t41hKhmi225DdrUPiWnyDdTQm1GdVbOymMRknJVPnZaSXw==} dev: true + /@sentry/types@8.7.0: + resolution: {integrity: sha512-11KLOKumP6akugVGLvSoEig+JlP0ZEzW3nN9P+ppgdIx9HAxMIh6UvumbieG4/DWjAh2kh6NPNfUw3gk2Gfq1A==} + engines: {node: '>=14.18'} + dev: true + /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true From 8ba4fc00e453f23930d5b4fc8e93c27ec0c861c3 Mon Sep 17 00:00:00 2001 From: David Newell Date: Fri, 22 Nov 2024 09:46:59 +0000 Subject: [PATCH 4/4] add more types back --- react/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/react/package.json b/react/package.json index 3daebebd7..5c2d90420 100644 --- a/react/package.json +++ b/react/package.json @@ -65,5 +65,8 @@ "setupFilesAfterEnv": [ "given2/setup" ] + }, + "dependencies": { + "@sentry/types": "7.37.2" } }