-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(node)!: Collect request sessions via HTTP instrumentation (#14658)
- Loading branch information
Showing
25 changed files
with
366 additions
and
1,060 deletions.
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
15 changes: 6 additions & 9 deletions
15
dev-packages/node-integration-tests/suites/sessions/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 |
---|---|---|
@@ -1,26 +1,23 @@ | ||
import { loggingTransport } from '@sentry-internal/node-integration-tests'; | ||
import type { SessionFlusher } from '@sentry/core'; | ||
import * as Sentry from '@sentry/node'; | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/1337', | ||
release: '1.0', | ||
transport: loggingTransport, | ||
integrations: [ | ||
Sentry.httpIntegration({ | ||
// Flush after 2 seconds (to avoid waiting for the default 60s) | ||
sessionFlushingDelayMS: 2_000, | ||
}), | ||
], | ||
}); | ||
|
||
import { startExpressServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests'; | ||
import express from 'express'; | ||
|
||
const app = express(); | ||
|
||
// eslint-disable-next-line deprecation/deprecation | ||
const flusher = (Sentry.getClient() as Sentry.NodeClient)['_sessionFlusher'] as SessionFlusher; | ||
|
||
// Flush after 2 seconds (to avoid waiting for the default 60s) | ||
setTimeout(() => { | ||
flusher?.flush(); | ||
}, 2000); | ||
|
||
app.get('/test/success', (_req, res) => { | ||
res.send('Success!'); | ||
}); | ||
|
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
Oops, something went wrong.