Skip to content
Closed
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
2 changes: 1 addition & 1 deletion docs/concepts/otlp/sentry-with-otel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ If you're running both a Sentry SDK and OTel instrumentation in the same backend
- <LinkWithPlatformIcon
platform="javascript.node"
label="Node.js"
url="/platforms/javascript/guides/node/install/lightweight/#using-with-opentelemetry-otlp"
url="/platforms/javascript/guides/node/configuration/integrations/opentelemetry/"
/>
- <LinkWithPlatformIcon
platform="java"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
title: OpenTelemetry
description: "Connects Sentry to an OpenTelemetry setup that owns tracing."
supported:
- javascript.node
- javascript.aws-lambda
- javascript.azure-functions
- javascript.connect
- javascript.express
- javascript.fastify
- javascript.gcp-functions
- javascript.hapi
- javascript.hono
- javascript.koa
- javascript.nestjs
- javascript.nextjs
- javascript.nuxt
- javascript.solidstart
- javascript.sveltekit
- javascript.remix
- javascript.react-router
- javascript.astro
---

<AvailableSince version="11.0.0" />

_Import name: `Sentry.openTelemetryIntegration`_

This integration is not enabled by default. Use it when OpenTelemetry owns tracing in your application and you want Sentry's errors, logs, metrics and check-ins to land on the same traces.

Everything Sentry sends that carries trace information is attached to the OpenTelemetry span that's active when it happens, so it shows up on the same trace as the spans your OpenTelemetry SDK exports. Outgoing request propagation is left to your OpenTelemetry propagator.

An active Sentry span still takes precedence, so this only changes what happens when Sentry has no span of its own.

<Alert>

This integration sends no spans. To get your OpenTelemetry spans into Sentry, point your own exporter at Sentry's OTLP endpoint with `getOtlpTracesEndpoint()`, as shown below.

</Alert>

## Install

Install the OpenTelemetry packages you need alongside the Sentry SDK:

```bash {tabTitle:npm}
npm install @opentelemetry/api @opentelemetry/sdk-trace-node @opentelemetry/sdk-trace-base @opentelemetry/exporter-trace-otlp-http
```

```bash {tabTitle:yarn}
yarn add @opentelemetry/api @opentelemetry/sdk-trace-node @opentelemetry/sdk-trace-base @opentelemetry/exporter-trace-otlp-http
```

```bash {tabTitle:pnpm}
pnpm add @opentelemetry/api @opentelemetry/sdk-trace-node @opentelemetry/sdk-trace-base @opentelemetry/exporter-trace-otlp-http
```

## Configure

Leave Sentry tracing off so the two pipelines stay separate. `getOtlpTracesEndpoint()` turns your DSN into the URL and auth headers of Sentry's OTLP endpoint:

```javascript
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import * as Sentry from "@sentry/node";

const provider = new NodeTracerProvider({
spanProcessors: [
new BatchSpanProcessor(
new OTLPTraceExporter(Sentry.getOtlpTracesEndpoint("___PUBLIC_DSN___"))
),
],
});

provider.register();

Sentry.init({
dsn: "___PUBLIC_DSN___",
// Leave the OpenTelemetry setup to your own provider
enableOpenTelemetrySetup: false,
// No `tracesSampleRate`: OpenTelemetry owns spans, Sentry owns errors and logs
integrations: [Sentry.openTelemetryIntegration()],
});
```

Sentry sends no spans with this setup, and no Sentry span reaches your OpenTelemetry pipeline.

If you'd rather have Sentry own tracing and add your own instrumentation on top, see <PlatformLink to="/opentelemetry/custom-setup/">Using Your Existing OpenTelemetry Setup</PlatformLink> instead.
4 changes: 0 additions & 4 deletions docs/platforms/javascript/common/install/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ If you are using `import` in your application, your installation method depends

If you do not compile your code, you'll need to follow the [ESM instructions](./esm).

### I don't need automatic spans/transactions

If you don't need spans emitted by OpenTelemetry instrumentation, you can use `@sentry/node-core` in [Lightweight Mode](./lightweight) without OpenTelemetry dependencies. You still get errors, logs, metrics, breadcrumbs, and more. This mode is experimental.

</PlatformCategorySection>

<PlatformCategorySection supported={['browser']}>
Expand Down
211 changes: 0 additions & 211 deletions docs/platforms/javascript/common/install/lightweight.mdx

This file was deleted.

Loading
Loading