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
10 changes: 10 additions & 0 deletions docs/concepts/otlp/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,13 @@ The following SDKs support the `propagateTraceparent` option:
label="React Native"
url="/platforms/react-native/configuration/options/#propagateTraceparent"
/>

## Dedicated Integrations

The following SDKs have dedicated integrations that make setting up OTLP a breeze.

- <LinkWithPlatformIcon
platform="python"
label="Python"
url="/platforms/python/integrations/otlp"
/>
1 change: 1 addition & 0 deletions docs/platforms/python/integrations/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ The Sentry SDK uses integrations to hook into the functionality of popular libra
| ----------------------------------------------------------------------------------------------------------------------------------- | :--------------: |
| <LinkWithPlatformIcon platform="python.asgi" label="ASGI" url="/platforms/python/integrations/asgi" /> | |
| <LinkWithPlatformIcon platform="python.asyncio" label="asyncio" url="/platforms/python/integrations/asyncio" /> | |
| <LinkWithPlatformIcon platform="python.opentelemetry" label="Opentelemetry (OTLP)" url="/platforms/python/integrations/otlp" /> | |
| <LinkWithPlatformIcon platform="python.pure_eval" label="Enhanced Locals" url="/platforms/python/integrations/pure_eval" /> | |
| <LinkWithPlatformIcon platform="python.gnu_backtrace" label="GNU Backtrace" url="/platforms/python/integrations/gnu_backtrace" /> | |
| <LinkWithPlatformIcon platform="python.rust_tracing" label="Rust Tracing" url="/platforms/python/integrations/rust_tracing" /> | |
Expand Down
66 changes: 66 additions & 0 deletions docs/platforms/python/integrations/otlp/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: OpenTelemetry (OTLP)
description: "Learn about using OTLP to automatically send OpenTelemetry Traces to Sentry."
keywords: ["otlp", "otel", "opentelemetry"]
---

The OTLP integration configures the Sentry SDK to automatically send trace data instrumented by an OpenTelemetry SDK to Sentry's [OpenTelemetry Protocol](https://opentelemetry.io/docs/specs/otel/protocol/) [ingestion endpoint](/concepts/otlp).

## Install

Install `sentry-sdk` from PyPI with the `opentelemetry-otlp` extra.

```bash {tabTitle:pip}
pip install "sentry-sdk[opentelemetry-otlp]"
```
```bash {tabTitle:uv}
uv add "sentry-sdk[opentelemetry-otlp]"
```

## Configure

You need to configure both the OpenTelemetry and Sentry SDKs to get trace data.

### OpenTelemetry

For the OpenTelemetry SDK, you need to [configure instrumentation](https://opentelemetry.io/docs/languages/python/getting-started/#instrumentation) you want to capture.

### Sentry

For the Sentry SDK, you simply need to enable our `OTLPIntegration` along with your existing configuration.

<OnboardingOptionButtons
options={["error-monitoring", "logs"]}
/>

```python
import sentry_sdk
from sentry_sdk.integrations.otlp import OTLPIntegration

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
# Add data like request headers and IP for users, if applicable;
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=True,
# ___PRODUCT_OPTION_START___ logs
# Enable logs to be sent to Sentry
enable_logs=True,
# ___PRODUCT_OPTION_END___ logs
integrations=[
OTLPIntegration(),
],
)
```

## Behavior

Under the hood, the `OTLPIntegration` will setup the following parts:

* A [`SpanExporter`](https://opentelemetry.io/docs/concepts/components/#exporters) that will automatically setup the OTLP ingestion endpoint from your Sentry DSN. This enables tracing in Sentry. **Note:** _Do not_ also set up tracing via the Python SDK.
* A [`Propagator`](https://opentelemetry.io/docs/concepts/context-propagation/#propagation) that ensures [distributed tracing](/concepts/key-terms/tracing/distributed-tracing/) works
* Trace/Span linking for all other Sentry events such as Errors, Logs, Crons and Metrics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to call out that Logs, Crons, and Metrics require additional config?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't call that out on this line since this is more like a under-the-hood how it works section titled Behavior


## Supported Versions

- Python: 3.7+
- opentelemetry-distro: 0.35b0+
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
---
title: OpenTelemetry Support
title: Legacy OpenTelemetry Integration Support
description: "Using OpenTelemetry with Sentry Performance."
sidebar_order: 20
---

<Alert title="New Integration Option">

We now have a dedicated <PlatformLink to="/integrations/otlp"> OTLPIntegration</PlatformLink> that can directly ingest OpenTelemetry Traces into Sentry. We recommend moving over to the new setup since it is much simpler.

</Alert>

You can configure your [OpenTelemetry SDK](https://opentelemetry.io/) to send traces and spans to Sentry.

## Install
Expand Down
Loading