Skip to content
Merged
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
Expand Up @@ -50,6 +50,8 @@ const DEPENDENTS: Dependent[] = [
ignoreExports: [
// not supported in bun:
'NodeClient',
// Bun doesn't emit the required diagnostics_channel events
'processThreadBreadcrumbIntegration',
],
},
{
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/node-integration-tests/suites/anr/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ const ANR_EVENT_WITH_SCOPE = {
user: {
email: '[email protected]',
},
breadcrumbs: [
breadcrumbs: expect.arrayContaining([
{
timestamp: expect.any(Number),
message: 'important message!',
},
],
]),
};

conditionalTest({ min: 16 })('should report ANR when event loop blocked', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { spawn } from 'child_process';
import { join } from 'path';
import { loggingTransport } from '@sentry-internal/node-integration-tests';
import * as Sentry from '@sentry/node';
import { Worker } from 'worker_threads';

const __dirname = new URL('.', import.meta.url).pathname;

Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
transport: loggingTransport,
});

await new Promise(resolve => {
const child = spawn('sleep', ['a']);
child.on('error', resolve);
child.on('exit', resolve);
});

await new Promise(resolve => {
const worker = new Worker(join(__dirname, 'worker.mjs'));
worker.on('error', resolve);
worker.on('exit', resolve);
});

throw new Error('This is a test error');
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import type { Event } from '@sentry/types';
import { conditionalTest } from '../../../utils';
import { cleanupChildProcesses, createRunner } from '../../../utils/runner';

const EVENT = {
// and an exception that is our ANR
exception: {
values: [
{
type: 'Error',
value: 'This is a test error',
},
],
},
breadcrumbs: [
{
timestamp: expect.any(Number),
category: 'child_process',
message: "Child process exited with code '1'",
level: 'warning',
data: {
spawnfile: 'sleep',
},
},
{
timestamp: expect.any(Number),
category: 'worker_thread',
message: "Worker thread errored with 'Worker error'",
level: 'error',
data: {
threadId: expect.any(Number),
},
},
],
};

conditionalTest({ min: 20 })('should capture process and thread breadcrumbs', () => {
afterAll(() => {
cleanupChildProcesses();
});

test('ESM', done => {
createRunner(__dirname, 'app.mjs')
.withMockSentryServer()
.expect({ event: EVENT as Event })
.start(done);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
throw new Error('Worker error');
1 change: 1 addition & 0 deletions packages/astro/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export {
parameterize,
postgresIntegration,
prismaIntegration,
processThreadBreadcrumbIntegration,
redisIntegration,
requestDataIntegration,
rewriteFramesIntegration,
Expand Down
1 change: 1 addition & 0 deletions packages/aws-serverless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export {
setupNestErrorHandler,
postgresIntegration,
prismaIntegration,
processThreadBreadcrumbIntegration,
hapiIntegration,
setupHapiErrorHandler,
spotlightIntegration,
Expand Down
1 change: 1 addition & 0 deletions packages/google-cloud-serverless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export {
zodErrorsIntegration,
profiler,
amqplibIntegration,
processThreadBreadcrumbIntegration,
} from '@sentry/node';

export {
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export { spotlightIntegration } from './integrations/spotlight';
export { genericPoolIntegration } from './integrations/tracing/genericPool';
export { dataloaderIntegration } from './integrations/tracing/dataloader';
export { amqplibIntegration } from './integrations/tracing/amqplib';
export { processThreadBreadcrumbIntegration } from './integrations/processThread';

export { SentryContextManager } from './otel/contextManager';
export { generateInstrumentOnce } from './otel/instrument';
Expand Down
Loading
Loading