Skip to content

Commit cf08de6

Browse files
gggritsocoolguyzoneAbhiPrasad
authored
feat(otlp): Add basic OTLP beta documentation (#14453)
## DESCRIBE YOUR PR Sentry is working on OTLP ingestion! This'll allow customers to configure their OpenTelemetry SDKs to send traces directly to Sentry. This is a major departure from our current OTLP support, which mostly requires users to configure their SDKs in special ways. We are gearing up for a Limited Availability Beta with a few select customers. While we expect to hold their hand for a lot of it, it's still a good idea to have some public documentation they can refer to. I'm looking for feedback from the Docs team on where to best place this kind of generic documentation (I took a shot!) and from the SDKs team for how to make this document play nice with existing SDK documentation about OpenTelemetry. ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [x] None: Not urgent, can wait up to 1 week+ ## PRE-MERGE CHECKLIST - [x] Checked Vercel preview for correctness, including links - [x] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [x] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) --------- Co-authored-by: Alex Krawiec <[email protected]> Co-authored-by: Abhijeet Prasad <[email protected]>
1 parent 3006ee8 commit cf08de6

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

docs/concepts/otlp/index.mdx

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: OpenTelemetry Protocol (OTLP)
3+
sidebar_order: 400
4+
description: "Learn how to send OpenTelemetry trace data directly to Sentry from OpenTelemetry SDKs."
5+
keywords: ["otlp", "otel", "opentelemetry"]
6+
---
7+
8+
<Include name="feature-available-for-user-group-limited-avail.mdx" />
9+
10+
Sentry can ingest [OpenTelemetry](https://opentelemetry.io) traces directly via the [OpenTelemetry Protocol](https://opentelemetry.io/docs/specs/otel/protocol/). If you have an existing OpenTelemetry trace instrumentation, you can configure your OpenTelemetry exporter to send traces to Sentry directly. Sentry's OTLP ingestion endpoint is currently in development, and has a few known limitations:
11+
12+
- Span events are not supported. All span events are dropped during ingestion.
13+
- Span links are partially supported. We ingest and display span links, but they cannot be searched, filtered, or aggregated. Links are are shown in the [Trace View](https://docs.sentry.io/concepts/key-terms/tracing/trace-view/).
14+
- Array attributes are partially supported. We ingest and display array attributes, but they cannot be searched, filtered, or aggregated. Array attributes are shown in the [Trace View](https://docs.sentry.io/concepts/key-terms/tracing/trace-view/).
15+
- Sentry does not support ingesting OTLP metrics or OTLP logs.
16+
17+
The easiest way to configure an OpenTelemetry exporter is with environment variables. You'll need to configure the trace endpoint URL, as well as the authentication headers. Set these variables on the server where your application is running.
18+
19+
```bash {filename: .env}
20+
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="___OTLP_TRACES_URL___""
21+
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="x-sentry-auth=sentry sentry_key=___PUBLIC_KEY___"
22+
```
23+
24+
Alternatively, you can configure the OpenTelemetry Exporter directly in your application code. Here is an example with the OpenTelemetry Node SDK:
25+
26+
```typescript {filename: app.ts}
27+
import { NodeSDK } from "@opentelemetry/sdk-node";
28+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
29+
30+
const sdk = new NodeSDK({
31+
traceExporter: new OTLPTraceExporter({
32+
url: "___OTLP_TRACES_URL___",
33+
headers: {
34+
"x-sentry-auth": "sentry sentry_key=___PUBLIC_KEY___",
35+
},
36+
}),
37+
});
38+
39+
sdk.start();
40+
```
41+
42+
<Alert>
43+
If you are already using an OpenTelemetry SDK to send traces alongside a Sentry SDK to send errors, you'll need to follow the instructions in the <PlatformLink to="/opentelemetry/custom-setup/">Custom Setup documentation</PlatformLink> to adjust your SDK configuration.
44+
</Alert>
45+
46+
You can find the values of Sentry's OTLP endpoint and public key in your Sentry project settings.
47+
48+
1. Go to the [Settings > Projects](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/) page in Sentry.
49+
2. Select a project from the list.
50+
3. Go to the "Client Keys (DSN)" sub-page for this project under the "SDK Setup" heading.

src/components/codeContext.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type ProjectCodeKeywords = {
1414
ORG_ID: number;
1515
ORG_INGEST_DOMAIN: string;
1616
ORG_SLUG: string;
17+
OTLP_TRACES_URL: string;
1718
PROJECT_ID: number;
1819
PROJECT_SLUG: string;
1920
PUBLIC_DSN: string;
@@ -86,6 +87,7 @@ export const DEFAULTS: CodeKeywords = {
8687
MINIDUMP_URL:
8788
'https://o0.ingest.sentry.io/api/0/minidump/?sentry_key=examplePublicKey',
8889
UNREAL_URL: 'https://o0.ingest.sentry.io/api/0/unreal/examplePublicKey/',
90+
OTLP_TRACES_URL: 'https://o0.ingest.sentry.io/api/0/otlp/v1/traces',
8991
title: `example-org / example-project`,
9092
},
9193
],
@@ -137,6 +139,10 @@ const formatUnrealEngineURL = ({scheme, host, pathname, publicKey}: Dsn) => {
137139
return `${scheme}${host}/api${pathname}/unreal/${publicKey}/`;
138140
};
139141

142+
const formatOtlpTracesUrl = ({scheme, host, pathname}: Dsn) => {
143+
return `${scheme}${host}/api${pathname}/otlp/v1/traces`;
144+
};
145+
140146
const formatApiUrl = ({scheme, host}: Dsn) => {
141147
const apiHost = host.indexOf('.ingest.') >= 0 ? host.split('.ingest.')[1] : host;
142148

@@ -229,6 +235,7 @@ export async function fetchCodeKeywords(): Promise<CodeKeywords> {
229235
parsedDsn.host ?? `o${project.organizationId}.ingest.sentry.io`,
230236
MINIDUMP_URL: formatMinidumpURL(parsedDsn),
231237
UNREAL_URL: formatUnrealEngineURL(parsedDsn),
238+
OTLP_TRACES_URL: formatOtlpTracesUrl(parsedDsn),
232239
title: `${project.organizationSlug} / ${project.projectSlug}`,
233240
};
234241
}),

0 commit comments

Comments
 (0)