Skip to content

Commit

Permalink
feat(node): Add alias childProcessIntegration for `processThreadBre…
Browse files Browse the repository at this point in the history
…adcrumbIntegration` and deprecate it (#14334)
  • Loading branch information
lforst authored Nov 18, 2024
1 parent 3778ac9 commit 9993d1e
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const DEPENDENTS: Dependent[] = [
'NodeClient',
// Bun doesn't emit the required diagnostics_channel events
'processThreadBreadcrumbIntegration',
'childProcessIntegration',
],
},
{
Expand Down
6 changes: 5 additions & 1 deletion docs/migration/draft-v9-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

- Deprecated `transactionNamingScheme` option in `requestDataIntegration`.

## `@sentry/types``
## `@sentry/types`

- Deprecated `Request` in favor of `RequestEventData`.

## Server-side SDKs (`@sentry/node` and all dependents)

- Deprecated `processThreadBreadcrumbIntegration` in favor of `childProcessIntegration`. Functionally they are the same.
2 changes: 2 additions & 0 deletions packages/astro/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ export {
parameterize,
postgresIntegration,
prismaIntegration,
// eslint-disable-next-line deprecation/deprecation
processThreadBreadcrumbIntegration,
childProcessIntegration,
redisIntegration,
requestDataIntegration,
rewriteFramesIntegration,
Expand Down
2 changes: 2 additions & 0 deletions packages/aws-serverless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ export {
setupNestErrorHandler,
postgresIntegration,
prismaIntegration,
// eslint-disable-next-line deprecation/deprecation
processThreadBreadcrumbIntegration,
childProcessIntegration,
hapiIntegration,
setupHapiErrorHandler,
spotlightIntegration,
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-serverless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ export {
zodErrorsIntegration,
profiler,
amqplibIntegration,
// eslint-disable-next-line deprecation/deprecation
processThreadBreadcrumbIntegration,
childProcessIntegration,
} from '@sentry/node';

export {
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export { tediousIntegration } from './integrations/tracing/tedious';
export { genericPoolIntegration } from './integrations/tracing/genericPool';
export { dataloaderIntegration } from './integrations/tracing/dataloader';
export { amqplibIntegration } from './integrations/tracing/amqplib';
export { processThreadBreadcrumbIntegration } from './integrations/processThread';
// eslint-disable-next-line deprecation/deprecation
export { processThreadBreadcrumbIntegration, childProcessIntegration } from './integrations/childProcess';

export { SentryContextManager } from './otel/contextManager';
export { generateInstrumentOnce } from './otel/instrument';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { ChildProcess } from 'node:child_process';
import * as diagnosticsChannel from 'node:diagnostics_channel';
import type { Worker } from 'node:worker_threads';
import { addBreadcrumb, defineIntegration } from '@sentry/core';
import type { IntegrationFn } from '@sentry/types';

interface Options {
/**
Expand All @@ -13,9 +12,13 @@ interface Options {
includeChildProcessArgs?: boolean;
}

// TODO(v9): Update this name and mention in migration docs.
const INTEGRATION_NAME = 'ProcessAndThreadBreadcrumbs';

const _processThreadBreadcrumbIntegration = ((options: Options = {}) => {
/**
* Capture breadcrumbs for child processes and worker threads.
*/
export const childProcessIntegration = defineIntegration((options: Options = {}) => {
return {
name: INTEGRATION_NAME,
setup(_client) {
Expand All @@ -34,12 +37,14 @@ const _processThreadBreadcrumbIntegration = ((options: Options = {}) => {
});
},
};
}) satisfies IntegrationFn;
});

/**
* Capture breadcrumbs for child processes and worker threads.
*
* @deprecated Use `childProcessIntegration` integration instead. Functionally they are the same. `processThreadBreadcrumbIntegration` will be removed in the next major version.
*/
export const processThreadBreadcrumbIntegration = defineIntegration(_processThreadBreadcrumbIntegration);
export const processThreadBreadcrumbIntegration = childProcessIntegration;

function captureChildProcessEvents(child: ChildProcess, options: Options): void {
let hasExited = false;
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ import { consoleIntegration } from '../integrations/console';
import { nodeContextIntegration } from '../integrations/context';
import { contextLinesIntegration } from '../integrations/contextlines';

import { childProcessIntegration } from '../integrations/childProcess';
import { httpIntegration } from '../integrations/http';
import { localVariablesIntegration } from '../integrations/local-variables';
import { modulesIntegration } from '../integrations/modules';
import { nativeNodeFetchIntegration } from '../integrations/node-fetch';
import { onUncaughtExceptionIntegration } from '../integrations/onuncaughtexception';
import { onUnhandledRejectionIntegration } from '../integrations/onunhandledrejection';
import { processThreadBreadcrumbIntegration } from '../integrations/processThread';
import { INTEGRATION_NAME as SPOTLIGHT_INTEGRATION_NAME, spotlightIntegration } from '../integrations/spotlight';
import { getAutoPerformanceIntegrations } from '../integrations/tracing';
import { makeNodeTransport } from '../transports';
Expand Down Expand Up @@ -72,7 +72,7 @@ export function getDefaultIntegrationsWithoutPerformance(): Integration[] {
contextLinesIntegration(),
localVariablesIntegration(),
nodeContextIntegration(),
processThreadBreadcrumbIntegration(),
childProcessIntegration(),
...getCjsOnlyIntegrations(),
];
}
Expand Down

0 comments on commit 9993d1e

Please sign in to comment.