-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add Distributed Tracing Docs for Uptime #11911
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
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f66f425
add distributed tracing docs for uptime
gaprl a41bc0e
Add 'Allow Sampling' option for uptime alert configuration doc
gaprl 893188a
remove duplicated uptime sentry trace paragraph
gaprl 8fd99c1
language suggestions
lizokm 929aef7
Update docs/product/alerts/create-alerts/uptime-alert-config.mdx
lizokm bc49ce4
Update docs/product/alerts/uptime-monitoring/uptime-tracing.mdx
lizokm 3ec8092
Update docs/product/alerts/uptime-monitoring/uptime-tracing.mdx
lizokm 0d1f26f
Update docs/product/alerts/uptime-monitoring/uptime-tracing.mdx
lizokm f2c5b31
Update docs/product/alerts/uptime-monitoring/uptime-tracing.mdx
lizokm f3df00f
Update docs/product/alerts/uptime-monitoring/uptime-tracing.mdx
lizokm e2d6d7f
Update docs/product/alerts/uptime-monitoring/uptime-tracing.mdx
lizokm 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
103 changes: 103 additions & 0 deletions
103
docs/product/alerts/uptime-monitoring/uptime-tracing.mdx
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,103 @@ | ||
| --- | ||
| title: Distributed Tracing with Uptime | ||
| sidebar_order: 52 | ||
| description: "Learn how to leverage distributed tracing to troubleshoot downtime efficiently." | ||
lizokm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --- | ||
|
|
||
| Sentry's Uptime Monitoring uses [distributed tracing](/product/tracing/#whats-distributed-tracing) to track the flow and timing of requests and operations during uptime checks. This helps you quickly find the root cause of downtime by connecting related errors and performance data. | ||
|
|
||
| You can trace errors to identify and diagnose issues like crashes or exceptions. This is automatically enabled for all Uptime Alerts. You can also trace spans to monitor the performance and flow of operations, such as API calls or database queries. Span tracing is disabled by default, but can be enabled by allowing sampling in your Uptime Alert settings. Errors focus on problems, while spans focus on performance. | ||
|
|
||
| ## How Uptime Tracing Works | ||
|
|
||
| Sentry Uptime Tracing automatically appends a `sentry-trace` header to every outgoing request made to the configured URL in your Uptime Alert settings. This header propagates a trace identifier. | ||
|
|
||
| If one of Sentry's supported backend SDKs is configured for the application handling the incoming uptime check request, the trace will continue through your application. Learn more about [how distributed tracing works](/product/tracing/). | ||
|
|
||
| Example Uptime check request: | ||
|
|
||
| ```HTTP | ||
| GET /example-uptime-endpoint HTTP/1.1 | ||
| Host: sentry.io | ||
| User-Agent: SentryUptimeBot/1.0 (+http://docs.sentry.io/product/alerts/uptime-monitoring/) | ||
| Sentry-Trace: 32d4011600324838afcd666edadc1d09-8d5ca7419a02ca36 | ||
| ``` | ||
|
|
||
| ## Tracing Errors | ||
|
|
||
| Error tracing is enabled by default for uptime checks. When downtime is detected, an [Uptime Issue](/product/issues/issue-details/uptime-issues/) is created. You can then go to Sentry's [**Trace Explorer**](/product/explore/traces/) page to view any related errors. | ||
|
|
||
| Because uptime requests won't override your SDK’s error sampling rate, some errors may not appear in traces if that rate is set to below 1. | ||
|
|
||
| ### Disabling Error Tracing | ||
| To disable error tracing for uptime checks, filter out events from the SentryUptimeBot User-Agent in your SDK configuration. | ||
lizokm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| ### Disabling Uptime Error Tracing | ||
|
|
||
| To disable error tracing for uptime checks, configure a [before send](/platform-redirect/?next=/configuration/filtering/) filter in your SDK to ignore errors from Sentry's `User-Agent`. Here's an example: | ||
|
|
||
| ```typescript {tabTitle: Node.js Express} {filename: instrument.mjs} | ||
| import * as Sentry from "@sentry/node"; | ||
|
|
||
| Sentry.init({ | ||
| dsn: "___PUBLIC_DSN___", | ||
| // Filtering example for a Node.js Express app | ||
| beforeSend(event) { | ||
| const userAgent = event.request?.headers?.["user-agent"]; | ||
|
|
||
| // Ignore events captured in a request from SentryUptimeBot | ||
| if (userAgent && userAgent.includes("SentryUptimeBot")) { | ||
| return null; | ||
| } | ||
|
|
||
| // Process other events | ||
| return event; | ||
| }, | ||
| }); | ||
| ``` | ||
| ## Tracing Spans | ||
| Unlike error tracing, span tracing is **disabled** by default for uptime checks, but can be enabled by allowing sampling in your Uptime Alert settings. Enabling span tracing can be helpful because it provides a detailed view of the timing and flow of requests and operations during uptime checks, which is especially useful for diagnosing timeouts or performance issues. | ||
| ### Enabling Uptime Tracing of Spans | ||
lizokm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| To enable span tracing, modify your Uptime Alert settings with the "Allow Sampling" option. This will ensure that Sentry defers the sampling decision to your SDK, which will follow the trace sample rate you've configured. | ||
| Because uptime requests won't override your SDK’s error sampling rate, some errors may not appear in traces if that rate is set to below 1. | ||
|  | ||
| ### Custom Sampling | ||
lizokm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| To ensure that all spans from uptime checks are sampled, even if your SDK's trace sampling rate is below 1, you can configure a [sampling function](/platform-redirect/?next=/configuration/sampling/). Here's an example: | ||
| ```typescript {tabTitle: Node.js Express} {filename: instrument.mjs} | ||
| import * as Sentry from "@sentry/node"; | ||
|
|
||
| Sentry.init({ | ||
| dsn: "___PUBLIC_DSN___", | ||
| // Custom tracer function for a Node.js Express app | ||
| tracesSampler: ({ name, attributes, parentSampled }) => { | ||
| const userAgent = attributes?.["http.user_agent"]; | ||
|
|
||
| if ( | ||
| typeof userAgent === "string" && | ||
| userAgent.includes("SentryUptimeBot") | ||
| ) { | ||
| // Sample 100% of spans from SentryUptimeBot | ||
| return 1; | ||
| } | ||
|
|
||
| // Sample 50% of other spans | ||
| return 0.5; | ||
| }, | ||
| }); | ||
| ``` | ||
| ## Billing Considerations | ||
| Errors and spans captured during uptime checks are billed as regular events in Sentry. Configure sampling thoughtfully to manage costs. | ||
lizokm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.