-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(otlp): Add docs for OTLP logs endpoint #14898
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
Changes from 4 commits
6826f1b
c1736bc
844a601
38ff597
6737faf
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 |
---|---|---|
|
@@ -5,14 +5,17 @@ description: "Learn how to send OpenTelemetry trace data directly to Sentry from | |
keywords: ["otlp", "otel", "opentelemetry"] | ||
--- | ||
|
||
<Include name="feature-available-alpha-otlp.mdx" /> | ||
Sentry can ingest [OpenTelemetry](https://opentelemetry.io) traces and logs directly via the [OpenTelemetry Protocol](https://opentelemetry.io/docs/specs/otel/protocol/). Sentry does not support ingesting OTLP metrics. | ||
|
||
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: | ||
## OpenTelemetry Traces | ||
|
||
<Include name="feature-available-alpha-tracing.mdx" /> | ||
|
||
If you have an existing OpenTelemetry trace instrumentation, you can configure your OpenTelemetry exporter to send traces to Sentry directly. Sentry's OTLP ingestion traces endpoint is currently in development, and has a few known limitations: | ||
|
||
- Span events are not supported. All span events are dropped during ingestion. | ||
- 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](/concepts/key-terms/tracing/trace-view/). | ||
- 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](/concepts/key-terms/tracing/trace-view/). | ||
- Sentry does not support ingesting OTLP metrics or OTLP logs. | ||
|
||
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. | ||
|
||
|
@@ -39,8 +42,215 @@ const sdk = new NodeSDK({ | |
sdk.start(); | ||
``` | ||
|
||
You can find the values of Sentry's OTLP endpoint and public key in your Sentry project settings. | ||
You can find the values of Sentry's OTLP traces endpoint and public key in your Sentry project settings. | ||
|
||
1. Go to the [Settings > Projects](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/) page in Sentry. | ||
2. Select a project from the list. | ||
3. Go to the "Client Keys (DSN)" sub-page for this project under the "SDK Setup" heading. | ||
|
||
## OpenTelemetry Logs | ||
|
||
<Include name="feature-available-alpha-logs.mdx" /> | ||
|
||
If you have an existing OpenTelemetry log instrumentation, you can configure your OpenTelemetry exporter to send logs to Sentry directly. Sentry's OTLP ingestion logs endpoint has the following known limitations: | ||
|
||
- Array attributes are partially supported. We ingest and display array attributes, but they cannot be searched, filtered, or aggregated. | ||
|
||
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. | ||
|
||
```bash {filename: .env} | ||
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT="___OTLP_LOGS_URL___" | ||
export OTEL_EXPORTER_OTLP_LOGS_HEADERS="x-sentry-auth=sentry sentry_key=___PUBLIC_KEY___" | ||
``` | ||
|
||
Alternatively, you can configure the OpenTelemetry Exporter directly in your application code. Here is an example with the OpenTelemetry Node SDK: | ||
|
||
```typescript {filename: app.ts} | ||
import { | ||
LoggerProvider, | ||
BatchLogRecordProcessor, | ||
} from "@opentelemetry/sdk-logs"; | ||
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http"; | ||
|
||
const logExporter = new OTLPLogExporter({ | ||
url: "___OTLP_LOGS_URL___", | ||
headers: { | ||
"x-sentry-auth": "sentry sentry_key=___PUBLIC_KEY___", | ||
}, | ||
}); | ||
const loggerProvider = new LoggerProvider({ | ||
processors: [new BatchRecordProcessor(logExporter)], | ||
AbhiPrasad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
AbhiPrasad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
}); | ||
|
||
|
||
const logger = loggerProvider.getLogger("default", "1.0.0"); | ||
``` | ||
|
||
You can find the values of Sentry's OTLP logs endpoint and public key in your Sentry project settings. | ||
|
||
1. Go to the [Settings > Projects](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/) page in Sentry. | ||
2. Select a project from the list. | ||
3. Go to the "Client Keys (DSN)" sub-page for this project under the "SDK Setup" heading. | ||
|
||
## Distributed Tracing between Sentry Instrumentation and OpenTelemetry Instrumentation | ||
|
||
If you have a frontend or services instrumented with the Sentry SDK, and you are also instrumenting with OpenTelemetry, you can use the `propagateTraceparent` exposed in the Sentry SDK to propagate the W3C Trace Context `traceparent` header to the OpenTelemetry instrumentation. This will allow you to continue traces from Sentry instrumented services. | ||
|
||
The following SDKs support the `propagateTraceparent` option: | ||
|
||
### JavaScript | ||
|
||
- <LinkWithPlatformIcon | ||
platform="javascript.browser" | ||
label="Browser JavaScript" | ||
url="platforms/javascript/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.angular" | ||
label="Angular" | ||
url="/platforms/javascript/guides/angular/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.astro" | ||
label="Astro" | ||
url="/platforms/javascript/guides/astro/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.aws-lambda" | ||
label="AWS Lambda" | ||
url="/platforms/javascript/guides/aws-lambda/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.azure-functions" | ||
label="Azure Functions" | ||
url="/platforms/javascript/guides/azure-functions/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.bun" | ||
label="Bun" | ||
url="/platforms/javascript/guides/bun/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.cloudflare" | ||
label="Cloudflare" | ||
url="/platforms/javascript/guides/cloudflare/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.connect" | ||
label="Connect" | ||
url="/platforms/javascript/guides/connect/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.electron" | ||
label="Electron" | ||
url="/platforms/javascript/guides/electron/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.ember" | ||
label="Ember" | ||
url="/platforms/javascript/guides/ember/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.express" | ||
label="Express" | ||
url="/platforms/javascript/guides/express/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.fastify" | ||
label="Fastify" | ||
url="/platforms/javascript/guides/fastify/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.gatsby" | ||
label="Gatsby" | ||
url="/platforms/javascript/guides/gatsby/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.gcp-functions" | ||
label="Google Cloud Functions" | ||
url="/platforms/javascript/guides/gcp-functions/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.hapi" | ||
label="Hapi" | ||
url="/platforms/javascript/guides/hapi/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.hono" | ||
label="Hono" | ||
url="/platforms/javascript/guides/hono/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.koa" | ||
label="Koa" | ||
url="/platforms/javascript/guides/koa/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.nestjs" | ||
label="Nest.js" | ||
url="/platforms/javascript/guides/nestjs/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.node" | ||
label="Node.js" | ||
url="/platforms/javascript/guides/node/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.nextjs" | ||
label="Next.js" | ||
url="/platforms/javascript/guides/nextjs/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.nuxt" | ||
label="Nuxt" | ||
url="/platforms/javascript/guides/nuxt/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.react" | ||
label="React" | ||
url="/platforms/javascript/guides/react/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.react-router" | ||
label="React Router" | ||
url="/platforms/javascript/guides/react-router/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.remix" | ||
label="Remix" | ||
url="/platforms/javascript/guides/remix/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.solid" | ||
label="Solid" | ||
url="/platforms/javascript/guides/solid/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.solidstart" | ||
label="SolidStart" | ||
url="/platforms/javascript/guides/solidstart/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.svelte" | ||
label="Svelte" | ||
url="/platforms/javascript/guides/svelte/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.sveltekit" | ||
label="SvelteKit" | ||
url="/platforms/javascript/guides/sveltekit/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.tanstackstart-react" | ||
label="TanStack Start" | ||
url="/platforms/javascript/guides/tanstackstart-react/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.vue" | ||
label="Vue" | ||
url="/platforms/javascript/guides/vue/configuration/options/#propagateTraceparent" | ||
/> | ||
- <LinkWithPlatformIcon | ||
platform="javascript.wasm" | ||
label="Wasm" | ||
url="/platforms/javascript/guides/wasm/configuration/options/#propagateTraceparent" | ||
/> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Alert> | ||
|
||
This feature is in alpha and is only available if your organization is participating in its limited release. Please reach out to [[email protected]](mailto:[email protected]) if you want access. Features in alpha are still in-progress and may have bugs. We recognize the irony. | ||
|
||
</Alert> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Alert> | ||
|
||
This feature is in alpha and is only available if your organization is participating in its limited release. Please reach out to [[email protected]](mailto:[email protected]) if you want access. Features in alpha are still in-progress and may have bugs. We recognize the irony. | ||
|
||
</Alert> |
This file was deleted.
This file was deleted.
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.
Do we expect this list of limitations to grow? If not, I'd recommend not displaying this in a list format.
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.
yes the list will grow, so I'll keep it like this for now.