Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions docs/migration/draft-v9-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@
- Deprecated `processThreadBreadcrumbIntegration` in favor of `childProcessIntegration`. Functionally they are the same.
- Deprecated `nestIntegration`. Use the NestJS SDK (`@sentry/nestjs`) instead.
- Deprecated `setupNestErrorHandler`. Use the NestJS SDK (`@sentry/nestjs`) instead.
- Deprecated `addOpenTelemetryInstrumentation`. Use the `openTelemetryInstrumentations` option in `Sentry.init()` or your custom Sentry Client instead.
1 change: 1 addition & 0 deletions packages/astro/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export {
addBreadcrumb,
addEventProcessor,
addIntegration,
// eslint-disable-next-line deprecation/deprecation
addOpenTelemetryInstrumentation,
// eslint-disable-next-line deprecation/deprecation
addRequestDataToEvent,
Expand Down
1 change: 1 addition & 0 deletions packages/aws-serverless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"access": "public"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.54.0",
"@opentelemetry/instrumentation-aws-lambda": "0.44.0",
"@opentelemetry/instrumentation-aws-sdk": "0.45.0",
"@sentry/core": "8.40.0",
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 @@ -120,6 +120,7 @@ export {
spanToTraceHeader,
spanToBaggageHeader,
trpcMiddleware,
// eslint-disable-next-line deprecation/deprecation
addOpenTelemetryInstrumentation,
zodErrorsIntegration,
profiler,
Expand Down
31 changes: 15 additions & 16 deletions packages/aws-serverless/src/integration/aws.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { AwsInstrumentation } from '@opentelemetry/instrumentation-aws-sdk';
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration } from '@sentry/core';
import { addOpenTelemetryInstrumentation } from '@sentry/node';
import type { IntegrationFn } from '@sentry/types';

const _awsIntegration = (() => {
/**
* Instrumentation for aws-sdk package
*/
export const awsIntegration = defineIntegration(() => {
return {
name: 'Aws',
setupOnce() {
addOpenTelemetryInstrumentation(
new AwsInstrumentation({
preRequestHook(span) {
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.otel.aws');
},
}),
);
registerInstrumentations({
instrumentations: [
new AwsInstrumentation({
preRequestHook(span) {
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.otel.aws');
},
}),
],
});
},
};
}) satisfies IntegrationFn;

/**
* Instrumentation for aws-sdk package
*/
export const awsIntegration = defineIntegration(_awsIntegration);
});
1 change: 1 addition & 0 deletions packages/bun/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export {
spanToTraceHeader,
spanToBaggageHeader,
trpcMiddleware,
// eslint-disable-next-line deprecation/deprecation
addOpenTelemetryInstrumentation,
zodErrorsIntegration,
profiler,
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 @@ -117,6 +117,7 @@ export {
spanToTraceHeader,
spanToBaggageHeader,
trpcMiddleware,
// eslint-disable-next-line deprecation/deprecation
addOpenTelemetryInstrumentation,
zodErrorsIntegration,
profiler,
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 @@ -61,6 +61,7 @@ export type { NodeOptions } from './types';
export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from '@sentry/core';

export {
// eslint-disable-next-line deprecation/deprecation
addOpenTelemetryInstrumentation,
// These are custom variants that need to be used instead of the core one
// As they have slightly different implementations
Expand Down
9 changes: 3 additions & 6 deletions packages/node/src/integrations/node-fetch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { context, propagation, trace } from '@opentelemetry/api';
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import type { UndiciRequest, UndiciResponse } from '@opentelemetry/instrumentation-undici';
import { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';
import {
Expand All @@ -9,11 +10,7 @@ import {
hasTracingEnabled,
} from '@sentry/core';
import { getBreadcrumbLogLevelFromHttpStatusCode, getSanitizedUrlString, parseUrl } from '@sentry/core';
import {
addOpenTelemetryInstrumentation,
generateSpanContextForPropagationContext,
getPropagationContextFromSpan,
} from '@sentry/opentelemetry';
import { generateSpanContextForPropagationContext, getPropagationContextFromSpan } from '@sentry/opentelemetry';
import type { IntegrationFn, SanitizedRequestData } from '@sentry/types';

interface NodeFetchOptions {
Expand Down Expand Up @@ -94,7 +91,7 @@ const _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => {
},
});

addOpenTelemetryInstrumentation(instrumentation);
registerInstrumentations({ instrumentations: [instrumentation] });
},
};
}) satisfies IntegrationFn;
Expand Down
7 changes: 4 additions & 3 deletions packages/node/src/otel/instrument.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Instrumentation } from '@opentelemetry/instrumentation';
import { addOpenTelemetryInstrumentation } from '@sentry/opentelemetry';
import { type Instrumentation, registerInstrumentations } from '@opentelemetry/instrumentation';

/** Exported only for tests. */
export const INSTRUMENTED: Record<string, Instrumentation> = {};
Expand All @@ -26,7 +25,9 @@ export function generateInstrumentOnce<Options = unknown>(
const instrumentation = creator(options);
INSTRUMENTED[name] = instrumentation;

addOpenTelemetryInstrumentation(instrumentation);
registerInstrumentations({
instrumentations: [instrumentation],
});
},
{ id: name },
);
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export {

export { openTelemetrySetupCheck } from './utils/setupCheck';

// eslint-disable-next-line deprecation/deprecation
export { addOpenTelemetryInstrumentation } from './instrumentation';

// Legacy
Expand Down
3 changes: 3 additions & 0 deletions packages/opentelemetry/src/instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { registerInstrumentations } from '@opentelemetry/instrumentation';
/**
* This method takes an OpenTelemetry instrumentation or
* array of instrumentations and registers them with OpenTelemetry.
*
* @deprecated This method will be removed in the next major version of the SDK.
* Use the `openTelemetryInstrumentations` option in `Sentry.init()` or your custom Sentry Client instead.
*/
export function addOpenTelemetryInstrumentation(...instrumentations: Instrumentation[]): void {
registerInstrumentations({
Expand Down
1 change: 1 addition & 0 deletions packages/remix/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export {
addBreadcrumb,
addEventProcessor,
addIntegration,
// eslint-disable-next-line deprecation/deprecation
addOpenTelemetryInstrumentation,
// eslint-disable-next-line deprecation/deprecation
addRequestDataToEvent,
Expand Down
1 change: 1 addition & 0 deletions packages/solidstart/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {
addBreadcrumb,
addEventProcessor,
addIntegration,
// eslint-disable-next-line deprecation/deprecation
addOpenTelemetryInstrumentation,
// eslint-disable-next-line deprecation/deprecation
addRequestDataToEvent,
Expand Down
1 change: 1 addition & 0 deletions packages/sveltekit/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {
addBreadcrumb,
addEventProcessor,
addIntegration,
// eslint-disable-next-line deprecation/deprecation
addOpenTelemetryInstrumentation,
// eslint-disable-next-line deprecation/deprecation
addRequestDataToEvent,
Expand Down
Loading