-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(otlp): Add python OTLP integration #15093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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](https://opentelemetry.io) SDK to Sentry's [OpenTelemetry Protocol](https://opentelemetry.io/docs/specs/otel/protocol/) [ingestion endpoint](/concepts/otlp). | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I love links to all the information, but also having 3 in a row can make it hard to know what I'm focusing on. I suggest dropping the general one, as I assume people who land here will go to the protocol and then can dig in on otel.
Suggested change
|
||||||
|
|
||||||
| ## 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) as per your needs. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ### Sentry | ||||||
|
|
||||||
| For the Sentry SDK, you simply need to enable our `OTLPIntegration` along with your existing configuration. | ||||||
|
|
||||||
| <OnboardingOptionButtons | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this also call out tracing? It sounds like tracing is also auto opt-in like error monitoring, and we should show that.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. people should not use our tracing when they use opentelemetry tracing, it's going to either or. Maybe we should clarify that?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think it's a simple clarification. I added a suggestion in the behavior section below. |
||||||
| 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 | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * 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 | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||||||
|
|
||||||
| ## Supported Versions | ||||||
|
|
||||||
| - Python: 3.7+ | ||||||
| - opentelemetry-distro: 0.35b0+ | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,12 @@ description: "Using OpenTelemetry with Sentry Performance." | |||||
| sidebar_order: 20 | ||||||
| --- | ||||||
|
|
||||||
| <Alert> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| We have a dedicated <PlatformLink to="/integrations/otlp"> OTLPIntegration </PlatformLink> now that can directly ingest OpenTelemetry Traces into Sentry. We recommend moving over to the new setup since it is much simpler. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| </Alert> | ||||||
|
|
||||||
| You can configure your [OpenTelemetry SDK](https://opentelemetry.io/) to send traces and spans to Sentry. | ||||||
|
|
||||||
| ## Install | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this POTEL, or is there something else we've recently done to make Python specifically easier to set up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the original POTEL project is dead
this is the first of the OTLP SDKs which is the project that replaces POTEL leveraging our new OTLP ingestion support