Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as Sentry from '@sentry/node';
import { loggingTransport } from '@sentry-internal/node-integration-tests';

if (process.env.USE_ORCHESTRION === 'true') {
Sentry.experimentalUseDiagnosticsChannelInjection();
}
Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as Sentry from '@sentry/node';
import { loggingTransport } from '@sentry-internal/node-integration-tests';

if (process.env.USE_ORCHESTRION === 'true') {
Sentry.experimentalUseDiagnosticsChannelInjection();
}
Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,28 @@ app.post('/test-post-ignore-body', function (req, res) {
res.send({ status: 'ok', body: req.body });
});

// A mounted sub-router, so we get a `router`-type layer wrapping a
// `request_handler` layer — used to assert the router span encloses the route
// handler span it dispatches.
const userRouter = express.Router();
userRouter.get('/:id', (_req, res) => {
// Delay the response so the difference between the two instrumentations'
// router-span durations is unambiguous: the orchestrion router span stays
// open until the response finishes (~this delay), while the OTel one ends
// immediately (~0ms).
setTimeout(() => res.send({ response: 'response user' }), 100);
});
app.use('/test/router/user', userRouter);

// A sub-router mounted under a *parameterized* path. The transaction name /
// `http.route` should keep the parameter (`:version`) rather than the concrete
// value, otherwise route cardinality explodes.
const versionedRouter = express.Router({ mergeParams: true });
versionedRouter.get('/user', (_req, res) => {
res.send({ response: 'response versioned' });
});
app.use('/test/version/:version', versionedRouter);

Sentry.setupExpressErrorHandler(app);

startExpressServerAndSendPortToRunner(app);
Loading
Loading