From 751015d7677a8fd7a7d5cf9bd857bcd98811688c Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Wed, 4 Oct 2023 11:12:21 +0200 Subject: [PATCH] Add minimum version to otel node docs and fix snippets (#8080) --- .../performance/opentelemetry-install/javascript.nextjs.mdx | 2 ++ .../performance/opentelemetry-install/node.mdx | 2 ++ .../performance/opentelemetry-setup/javascript.nextjs.mdx | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/platform-includes/performance/opentelemetry-install/javascript.nextjs.mdx b/src/platform-includes/performance/opentelemetry-install/javascript.nextjs.mdx index f8755b96dd217..b4d4ef1b299cf 100644 --- a/src/platform-includes/performance/opentelemetry-install/javascript.nextjs.mdx +++ b/src/platform-includes/performance/opentelemetry-install/javascript.nextjs.mdx @@ -12,6 +12,8 @@ npm install @sentry/nextjs @sentry/opentelemetry-node yarn add @sentry/nextjs @sentry/opentelemetry-node ``` +The minimum required version of the `@sentry/node` and the `@sentry/opentelemetry-node` package is `7.20.0` and their versions should always be aligned. + Note that @sentry/opentelemetry-node depends on the following peer dependencies: diff --git a/src/platform-includes/performance/opentelemetry-install/node.mdx b/src/platform-includes/performance/opentelemetry-install/node.mdx index d422b0b64eae4..4feacd1031501 100644 --- a/src/platform-includes/performance/opentelemetry-install/node.mdx +++ b/src/platform-includes/performance/opentelemetry-install/node.mdx @@ -6,6 +6,8 @@ npm install @sentry/node @sentry/opentelemetry-node yarn add @sentry/node @sentry/opentelemetry-node ``` +The minimum required version of the `@sentry/node` and the `@sentry/opentelemetry-node` package is `7.20.0` and their versions should always be aligned. + Note that @sentry/opentelemetry-node depends on the following peer dependencies: diff --git a/src/platform-includes/performance/opentelemetry-setup/javascript.nextjs.mdx b/src/platform-includes/performance/opentelemetry-setup/javascript.nextjs.mdx index 8fcb2d41d664b..e72815500dfe8 100644 --- a/src/platform-includes/performance/opentelemetry-setup/javascript.nextjs.mdx +++ b/src/platform-includes/performance/opentelemetry-setup/javascript.nextjs.mdx @@ -1,6 +1,6 @@ 1. Follow the Next.js instructions to set up a [manual OpenTelemetry configuration](https://nextjs.org/docs/app/building-your-application/optimizing/open-telemetry#manual-opentelemetry-configuration). -2. Check to make sure you've added `instrumentation.{js,ts}` and `instrumentation.node.{js,ts}` files to your application. +2. Check to make sure you've added `instrumentation.{js,ts}` and `instrumentation.node.{js,ts}` files to your application. Note that, until this feature moves out of the experimental phase, Next.js requires you to set `experimental.instrumentationHook: true` in your `next.config.js` to enable these files. 3. Enable your `sentry.server.config.js` file to be able to use the OpenTelemetry instrumenter option. @@ -25,6 +25,10 @@ import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; import { Resource } from "@opentelemetry/resources"; import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions"; import { SimpleSpanProcessor } from "@opentelemetry/sdk-trace-node"; +import { + SentrySpanProcessor, + SentryPropagator, +} from "@sentry/opentelemetry-node"; const sdk = new NodeSDK({ resource: new Resource({