-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: Switch to new transports #4943
Merged
Merged
Changes from 43 commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
5745c33
feat(core): Introduce seperate client options
AbhiPrasad fd4dcd8
introduce diff option types
AbhiPrasad d2e8764
introduce diff browser types:
AbhiPrasad f1701b4
node client options
AbhiPrasad b77cd21
switch browser
AbhiPrasad 7735f79
don't do anything with the dsn
AbhiPrasad 523bdf7
dsn type fix
AbhiPrasad 5a64ba8
remove default core options
AbhiPrasad cd01213
add comments
AbhiPrasad 0d00e20
cast option types
AbhiPrasad b3cfe41
explicit types
AbhiPrasad 8cb4fac
fix tests
AbhiPrasad 1463745
fix transport types
AbhiPrasad 4e1c76c
round 1 of fixing tests
AbhiPrasad 71fbb8e
tmp fix core `sdk.test.ts`
Lms24 35a8000
Add tests for integration setup in node init
lforst a089559
add tests for integration setup in browser init
Lms24 b2bd018
Fix some eslint errors in node tests
lforst 4fd61b6
Extract `getDefaultNodeClientOptions` into helper module
lforst c6f8b1e
fix remaning browser unit tests
Lms24 381e827
fix linter errors
Lms24 dd383b5
move types to types
AbhiPrasad 45b982f
delete from old place
AbhiPrasad 24936ae
change client types
AbhiPrasad 8644b0b
the rest of the owl
AbhiPrasad 6e50fa8
yarn fix
AbhiPrasad 3dbae89
optional url
AbhiPrasad 00d8ee6
refactor api usage in client
AbhiPrasad 0dfcd24
fix types
AbhiPrasad d79a586
remove transport from session flusher
AbhiPrasad 32739b4
add session aggregate typing
AbhiPrasad 8ab6bed
tracing transport fix
AbhiPrasad 8852906
types cleanup
AbhiPrasad bbd53ae
fix bad rebase
AbhiPrasad ea27746
delete setup tests
AbhiPrasad 173c7f3
fix hub tests
AbhiPrasad 27b0552
fix core tests
AbhiPrasad c1dccf0
fix node tests
AbhiPrasad fec5f7c
fix browser tests
AbhiPrasad ae0b8f5
fix browser integration tests
AbhiPrasad 5c979df
fix node integration tests
AbhiPrasad b058af1
delete console log
AbhiPrasad 534ced3
Merge branch '7.x' into v7-abhi-use-new-transport
AbhiPrasad 10b1bf7
lint fix
AbhiPrasad 2d299d4
fix node release health tests
AbhiPrasad 7a86050
work toward fixing nextjs tests
AbhiPrasad 3d1a6a4
fix node integration tests
AbhiPrasad 174362f
fix tracing tests
AbhiPrasad 8f0bdbf
PR review
AbhiPrasad fec138c
comment out test
AbhiPrasad 6d9eb92
tracing fix
AbhiPrasad 73d6c82
Fix nextjs integration tests nocks
lforst c12a077
Fix copy paste error
lforst 626f261
Fix next integration tests
lforst 29a2c7a
Fix nextjs unit tests
lforst 2f3105a
Fix linter errors
lforst d895160
Fix browser integration tests by implementing timout function
lforst e2b1864
Merge branch '7.x' into v7-abhi-use-new-transport
AbhiPrasad f301815
fix ember tests
AbhiPrasad ac1db21
only add 1 event processor
AbhiPrasad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ import { | |
wrap, | ||
} from '../../src'; | ||
import { getDefaultBrowserClientOptions } from './helper/browser-client-options'; | ||
import { SimpleTransport } from './mocks/simpletransport'; | ||
import { makeSimpleTransport } from './mocks/simpletransport'; | ||
|
||
const dsn = 'https://[email protected]/4291'; | ||
|
||
|
@@ -31,7 +31,7 @@ describe('SentryBrowser', () => { | |
init({ | ||
beforeSend, | ||
dsn, | ||
transport: SimpleTransport, | ||
transport: makeSimpleTransport, | ||
}); | ||
}); | ||
|
||
|
@@ -77,7 +77,7 @@ describe('SentryBrowser', () => { | |
describe('user', () => { | ||
const EX_USER = { email: '[email protected]' }; | ||
const options = getDefaultBrowserClientOptions({ dsn }); | ||
const client = new BrowserClient(options, new SimpleTransport({ dsn })); | ||
const client = new BrowserClient(options); | ||
const reportDialogSpy = jest.spyOn(client, 'showReportDialog'); | ||
|
||
beforeEach(() => { | ||
|
@@ -150,7 +150,7 @@ describe('SentryBrowser', () => { | |
}, | ||
dsn, | ||
}); | ||
getCurrentHub().bindClient(new BrowserClient(options, new SimpleTransport({ dsn }))); | ||
getCurrentHub().bindClient(new BrowserClient(options)); | ||
captureMessage('test'); | ||
}); | ||
|
||
|
@@ -164,7 +164,7 @@ describe('SentryBrowser', () => { | |
}, | ||
dsn, | ||
}); | ||
getCurrentHub().bindClient(new BrowserClient(options, new SimpleTransport({ dsn }))); | ||
getCurrentHub().bindClient(new BrowserClient(options)); | ||
captureEvent({ message: 'event' }); | ||
}); | ||
|
||
|
@@ -175,7 +175,7 @@ describe('SentryBrowser', () => { | |
dsn, | ||
integrations: [], | ||
}); | ||
getCurrentHub().bindClient(new BrowserClient(options, new SimpleTransport({ dsn }))); | ||
getCurrentHub().bindClient(new BrowserClient(options)); | ||
|
||
captureMessage('event222'); | ||
captureMessage('event222'); | ||
|
@@ -192,7 +192,7 @@ describe('SentryBrowser', () => { | |
dsn, | ||
integrations: [new Integrations.InboundFilters({ ignoreErrors: ['capture'] })], | ||
}); | ||
getCurrentHub().bindClient(new BrowserClient(options, new SimpleTransport({ dsn }))); | ||
getCurrentHub().bindClient(new BrowserClient(options)); | ||
|
||
captureMessage('capture'); | ||
|
||
|
@@ -244,7 +244,7 @@ describe('SentryBrowser initialization', () => { | |
it('should set SDK data when Sentry.init() is called', () => { | ||
init({ dsn }); | ||
|
||
const sdkData = (getCurrentHub().getClient() as any).getTransport()._api.metadata?.sdk; | ||
const sdkData = (getCurrentHub().getClient() as any).getOptions()._metadata.sdk; | ||
|
||
expect(sdkData?.name).toBe('sentry.javascript.browser'); | ||
expect(sdkData?.packages[0].name).toBe('npm:@sentry/browser'); | ||
|
@@ -254,9 +254,9 @@ describe('SentryBrowser initialization', () => { | |
|
||
it('should set SDK data when instantiating a client directly', () => { | ||
const options = getDefaultBrowserClientOptions({ dsn }); | ||
const client = new BrowserClient(options, new SimpleTransport({ dsn })); | ||
const client = new BrowserClient(options); | ||
|
||
const sdkData = (client.getTransport() as any)._api.metadata?.sdk; | ||
const sdkData = client.getOptions()._metadata?.sdk as any; | ||
|
||
expect(sdkData.name).toBe('sentry.javascript.browser'); | ||
expect(sdkData.packages[0].name).toBe('npm:@sentry/browser'); | ||
|
@@ -284,7 +284,7 @@ describe('SentryBrowser initialization', () => { | |
}, | ||
}); | ||
|
||
const sdkData = (getCurrentHub().getClient() as any).getTransport()._api.metadata?.sdk; | ||
const sdkData = (getCurrentHub().getClient() as any).getOptions()._metadata?.sdk; | ||
|
||
expect(sdkData.name).toBe('sentry.javascript.angular'); | ||
expect(sdkData.packages[0].name).toBe('npm:@sentry/angular'); | ||
|
@@ -305,7 +305,7 @@ describe('wrap()', () => { | |
}, | ||
dsn, | ||
}); | ||
getCurrentHub().bindClient(new BrowserClient(options, new SimpleTransport({ dsn }))); | ||
getCurrentHub().bindClient(new BrowserClient(options)); | ||
|
||
try { | ||
wrap(() => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,6 @@ | ||
import { eventStatusFromHttpCode, resolvedSyncPromise } from '@sentry/utils'; | ||
import { resolvedSyncPromise } from '@sentry/utils'; | ||
import { createTransport } from '@sentry/core'; | ||
|
||
import { Event, Response } from '../../../src'; | ||
import { BaseTransport } from '../../../src/transports'; | ||
|
||
// @ts-ignore It's okay that we're not implementing the `_sendRequest()` method because we don't use it in our tests | ||
export class SimpleTransport extends BaseTransport { | ||
public sendEvent(_: Event): PromiseLike<Response> { | ||
return this._buffer.add(() => | ||
resolvedSyncPromise({ | ||
status: eventStatusFromHttpCode(200), | ||
}), | ||
); | ||
} | ||
export function makeSimpleTransport() { | ||
return createTransport({}, () => resolvedSyncPromise({ statusCode: 200 })); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR might be a good opportuinity to add the transport changes to the migration docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah agree, I'll add those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided that I'll do this in a follow up PR!