-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: Document OTLP drains for cloudflare and heroku #15356
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
Merged
+184
−16
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| --- | ||
| title: Cloudflare Workers Observability | ||
| sidebar_order: 75 | ||
| description: Learn how to set up Cloudflare Workers Observability to send forward logs and traces data to Sentry. | ||
| --- | ||
|
|
||
| Cloudflare Workers supports [exporting OpenTelemetry (OTEL)-compliant](https://developers.cloudflare.com/workers/observability/exporting-opentelemetry-data/) to send logs and traces to Sentry. | ||
|
|
||
| - Logs: Application logs including `console.log()` output and system-generated logs | ||
| - Traces: Traces showing request flows through your Worker and connected services | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Before you begin, ensure you have: | ||
|
|
||
| - A deployed Worker that you want to monitor | ||
| - A Sentry project you want to send data to | ||
|
|
||
| ## Step 1: Set up destination in the Cloudflare dashboard | ||
|
|
||
| To set up a destination in the Cloudflare dashboard, navigate to your Cloudflare account's [Workers Observability](https://dash.cloudflare.com/?to=/:account/workers-and-pages/observability/pipelines) section. Then click **Add destination** and configure either a traces or logs destination. | ||
|
|
||
| ### Logs Destination | ||
|
|
||
| To configure your logs destination, click **Add destination** and configure the following: | ||
|
|
||
| 1. Destination Name: `sentry-logs` (or any descriptive name) | ||
| 2. Destination Type: Select Logs | ||
| 3. OTLP Endpoint: Your Sentry OTLP logs endpoint (e.g., `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/logs`) | ||
|
|
||
| ``` | ||
| ___OTLP_LOGS_URL___ | ||
| ``` | ||
|
|
||
| 4. Custom Headers: Add the Sentry authentication header: | ||
| - Header name: `x-sentry-auth` | ||
| - Header value: `sentry sentry_key={SENTRY_PUBLIC_KEY}` where `{SENTRY_PUBLIC_KEY}` is your Sentry project's public key | ||
|
|
||
| ``` | ||
| sentry sentry_key=___PUBLIC_KEY___ | ||
| ``` | ||
|
|
||
| You can find your Sentry OTLP logs endpoint and authentication header value in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)** under the **OTLP Logs Endpoint** section. | ||
|
|
||
| ### Traces Destination | ||
|
|
||
| To configure your traces destination, click **Add destination** and configure the following: | ||
|
|
||
| 1. Destination Name: `sentry-traces` (or any descriptive name) | ||
| 2. Destination Type: Select Traces | ||
| 3. OTLP Endpoint: Your Sentry OTLP traces endpoint (e.g., `https://{HOST}/api/{PROJECT_ID}/integration/otlp/v1/traces`) | ||
|
|
||
| ``` | ||
| ___OTLP_TRACES_URL___ | ||
| ``` | ||
|
|
||
| 4. Custom Headers: Add the Sentry authentication header: | ||
| - Header name: `x-sentry-auth` | ||
| - Header value: `sentry sentry_key={SENTRY_PUBLIC_KEY}` where `{SENTRY_PUBLIC_KEY}` is your Sentry project's public key | ||
|
|
||
| ``` | ||
| sentry sentry_key=___PUBLIC_KEY___ | ||
| ``` | ||
|
|
||
| You can find your Sentry OTLP traces endpoint and authentication header value in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)** under the **OTLP Traces Endpoint** section. | ||
|
|
||
| ## Step 2: Configure your Worker | ||
|
|
||
| With your destinations created in the Cloudflare dashboard, update your Worker's configuration to enable telemetry export. | ||
|
|
||
| ```toml {filename:wrangler.toml} | ||
| [observability.traces] | ||
| enabled = true | ||
| # Must match the destination name in the dashboard | ||
| destinations = [ "sentry-traces" ] | ||
|
|
||
| [observability.logs] | ||
| enabled = true | ||
| # Must match the destination name in the dashboard | ||
| destinations = [ "sentry-logs" ] | ||
| ``` | ||
|
|
||
| ```jsonc {filename:wrangler.jsonc} | ||
| { | ||
| "observability": { | ||
| "traces": { | ||
| "enabled": true, | ||
| // Must match the destination name in the dashboard | ||
| "destinations": ["sentry-traces"], | ||
| }, | ||
| "logs": { | ||
| "enabled": true, | ||
| // Must match the destination name in the dashboard | ||
| "destinations": ["sentry-logs"], | ||
| }, | ||
| }, | ||
| } | ||
| ``` | ||
|
|
||
| After updating your configuration, deploy your Worker for the changes to take effect. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| --- | ||
| title: Heroku Telemetry Drains | ||
| sidebar_order: 75 | ||
| description: Learn how to set up Heroku Telemetry Drains to send forward logs and traces data to Sentry. | ||
| --- | ||
|
|
||
| Heroku Telemetry supports [exporting OpenTelemetry (OTEL)-compliant](https://devcenter.heroku.com/articles/heroku-telemetry) to send logs and traces to Sentry. Sending metrics is not supported yet. | ||
|
|
||
| <Alert level="warning"> | ||
|
|
||
| Heroku telemetry drains are only available to [Fir](https://devcenter.heroku.com/articles/generations#fir)-generation apps and spaces. We are tracking support for Cedar-generation apps and spaces in [this issue](https://github.com/getsentry/sentry/issues/91727). | ||
|
|
||
| </Alert> | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Before you begin, ensure you have: | ||
|
|
||
| - A Heroku app that you want to monitor | ||
| - A Sentry project you want to send data to | ||
|
|
||
| ## Adding a Telemetry Drain | ||
|
|
||
| To add a telemetry drain to an app or space, use the `heroku telemetry:add` command. For more details, see the [Heroku Telemetry documentation](https://devcenter.heroku.com/articles/working-with-heroku-telemetry-drains#add-a-telemetry-drain). | ||
|
|
||
| When using the `heroku telemetry:add` command, you'll need to provide your Sentry project's OTLP endpoint URL and a `x-sentry-auth` header with the public key. This can be found in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)**. | ||
|
|
||
| ```bash | ||
| heroku telemetry:add ___OTLP_URL___ --app myapp --signals logs,traces --transport http --headers '{"x-sentry-auth":"sentry sentry_key=___PUBLIC_KEY___"}' | ||
| ``` | ||
|
|
||
| To add a telemetry drain to the entire space: | ||
|
|
||
| ```bash | ||
| heroku telemetry:add ___OTLP_URL___ --space myspace --signals logs,traces --headers '{"x-sentry-auth":"sentry sentry_key=___PUBLIC_KEY___"}' | ||
| ``` | ||
|
|
||
| You can use the `--signals` flag to specify the signals you want to send to Sentry. Only `logs` and `traces` are supported. | ||
|
|
||
| <Alert level="warning"> | ||
|
|
||
| Sentry only supports the `http` `--transport` flag. | ||
|
|
||
| </Alert> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Bug: URL Consistency Issue in OTLP Configuration
The
OTLP_URLinDEFAULTSis missing a trailing slash, but theformatOtlpUrlfunction generates URLs that include one. This inconsistency means theOTLP_URLwill vary depending on whether the default value is used or if it's dynamically generated, which could lead to unexpected behavior or integration issues.