forked from getsentry/sentry-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(node): Ensure isolation scope is correctly cloned for non-recordi…
…ng spans (getsentry#11503) Our Http instrumentation didn't clone the isolation scope correctly when the request span is not recording. We early returned if the span was not a server kind span. However, non-recording spans apparently have no span kind, so we wrongfully early returned in the check for non-recording spans.
- Loading branch information
1 parent
bbf9ecb
commit a5b1c21
Showing
6 changed files
with
88 additions
and
9 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
dev-packages/node-integration-tests/suites/express/handle-error-tracesSampleRate-0/server.ts
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { loggingTransport } from '@sentry-internal/node-integration-tests'; | ||
import * as Sentry from '@sentry/node'; | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
transport: loggingTransport, | ||
tracesSampleRate: 1, | ||
}); | ||
|
||
import { startExpressServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests'; | ||
import express from 'express'; | ||
|
||
const app = express(); | ||
|
||
app.get('/test/express/:id', req => { | ||
throw new Error(`test_error with id ${req.params.id}`); | ||
}); | ||
|
||
Sentry.setupExpressErrorHandler(app); | ||
|
||
startExpressServerAndSendPortToRunner(app); |
39 changes: 39 additions & 0 deletions
39
dev-packages/node-integration-tests/suites/express/handle-error-tracesSampleRate-0/test.ts
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; | ||
|
||
afterAll(() => { | ||
cleanupChildProcesses(); | ||
}); | ||
|
||
test('should capture and send Express controller error with txn name if tracesSampleRate is 0', done => { | ||
const runner = createRunner(__dirname, 'server.ts') | ||
.ignore('session', 'sessions', 'transaction') | ||
.expect({ | ||
event: { | ||
exception: { | ||
values: [ | ||
{ | ||
mechanism: { | ||
type: 'middleware', | ||
handled: false, | ||
}, | ||
type: 'Error', | ||
value: 'test_error with id 123', | ||
stacktrace: { | ||
frames: expect.arrayContaining([ | ||
expect.objectContaining({ | ||
function: expect.any(String), | ||
lineno: expect.any(Number), | ||
colno: expect.any(Number), | ||
}), | ||
]), | ||
}, | ||
}, | ||
], | ||
}, | ||
transaction: 'GET /test/express/:id', | ||
}, | ||
}) | ||
.start(done); | ||
|
||
expect(() => runner.makeRequest('get', '/test/express/123')).rejects.toThrow(); | ||
}); |
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