diff --git a/.claude/skills/technical-docs/SKILL.md b/.claude/skills/technical-docs/SKILL.md index 4b75b004556fb..e1920ce49918d 100644 --- a/.claude/skills/technical-docs/SKILL.md +++ b/.claude/skills/technical-docs/SKILL.md @@ -113,16 +113,6 @@ Good best practice: ## Sentry Docs Specific Patterns -### SplitLayout Usage - -Use `` for side-by-side text/code when: -- The code directly illustrates the text -- Both are needed to understand the concept - -Don't use when: -- Showing a directory structure (use plain code block) -- The text is just "here's an example" (just show the code) - ### PlatformLink Usage Link to related docs rather than repeating content: diff --git a/docs/concepts/otlp/forwarding/pipelines/collector.mdx b/docs/concepts/otlp/forwarding/pipelines/collector.mdx index e420c2d8f1526..c36205566f8fc 100644 --- a/docs/concepts/otlp/forwarding/pipelines/collector.mdx +++ b/docs/concepts/otlp/forwarding/pipelines/collector.mdx @@ -18,18 +18,11 @@ Before you begin, ensure you have: ## Step 1: Get Your Sentry OTLP Credentials - - - - Find these in [Sentry Project Settings](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/:projectId/keys/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)**. - Use the **combined endpoint** if sending both logs and traces - The Collector appends `/v1/logs` or `/v1/traces` automatically - - - ```bash # Logs endpoint ___OTLP_LOGS_URL___ @@ -44,25 +37,14 @@ ___OTLP_URL___ x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___ ``` - - - - ## Step 2: Configure the Collector Update your OpenTelemetry Collector configuration to add the `otlphttp` exporter pointing to Sentry. - - - - ### Logs Only Use `logs_endpoint` to forward only logs to Sentry. - - - ```yaml {filename:otel-collector.yaml} exporters: otlphttp/sentry: @@ -73,19 +55,10 @@ exporters: encoding: proto ``` - - - - - - ### Traces Only Use `traces_endpoint` to forward only traces to Sentry. - - - ```yaml {filename:otel-collector.yaml} exporters: otlphttp/sentry: @@ -96,19 +69,10 @@ exporters: encoding: proto ``` - - - - - - ### Logs and Traces Use the combined `endpoint` to forward both logs and traces. The Collector appends the appropriate path for each signal type. - - - ```yaml {filename:otel-collector.yaml} exporters: otlphttp/sentry: @@ -119,10 +83,6 @@ exporters: encoding: proto ``` - - - - ## Routing to Multiple Projects @@ -131,10 +91,6 @@ For simpler multi-project routing, consider the [Sentry Exporter](/concepts/otlp - - - - Sentry's OTLP endpoints are project-specific. To route telemetry from different services to different Sentry projects using `otlphttp`, use the [routing connector](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/connector/routingconnector). This example routes logs to different Sentry projects based on the `service.name` attribute: @@ -142,9 +98,6 @@ This example routes logs to different Sentry projects based on the `service.name - Logs with `service.name: "service-b"` go to Project B - All other logs go to Project A (the default) - - - ```yaml {filename:otel-collector.yaml} receivers: otlp: @@ -187,7 +140,3 @@ service: receivers: [routing] exporters: [otlphttp/project-b] ``` - - - - diff --git a/docs/concepts/otlp/forwarding/pipelines/fluentbit.mdx b/docs/concepts/otlp/forwarding/pipelines/fluentbit.mdx index 514341e37d0b6..5c7400d09bf1b 100644 --- a/docs/concepts/otlp/forwarding/pipelines/fluentbit.mdx +++ b/docs/concepts/otlp/forwarding/pipelines/fluentbit.mdx @@ -16,15 +16,8 @@ Before you begin, ensure you have: ## Step 1: Get Your Sentry OTLP Credentials - - - - Find these in [Sentry Project Settings](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/:projectId/keys/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)**. - - - ```bash # Logs endpoint ___OTLP_LOGS_URL___ @@ -36,25 +29,14 @@ ___OTLP_TRACES_URL___ x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___ ``` - - - - ## Step 2: Configure Fluent Bit Add the OpenTelemetry output plugin to your Fluent Bit configuration to forward data to Sentry. - - - - ### Logs Only Use `logs_uri` to forward only logs to Sentry. - - - ```yaml {filename:fluent-bit.yaml} pipeline: outputs: @@ -81,19 +63,10 @@ pipeline: Header x-sentry-auth sentry sentry_key=___PUBLIC_KEY___ ``` - - - - - - ### Traces Only Use `traces_uri` to forward only traces to Sentry. - - - ```yaml {filename:fluent-bit.yaml} pipeline: outputs: @@ -120,19 +93,10 @@ pipeline: Header x-sentry-auth sentry sentry_key=___PUBLIC_KEY___ ``` - - - - - - ### Logs and Traces Include both `logs_uri` and `traces_uri` to forward logs and traces to Sentry. - - - ```yaml {filename:fluent-bit.yaml} pipeline: outputs: @@ -161,10 +125,6 @@ pipeline: Header x-sentry-auth sentry sentry_key=___PUBLIC_KEY___ ``` - - - - ## Optional Configuration Fluent Bit's OpenTelemetry output plugin supports additional options for fine-tuning your setup: diff --git a/docs/concepts/otlp/forwarding/pipelines/sentry-exporter.mdx b/docs/concepts/otlp/forwarding/pipelines/sentry-exporter.mdx index 700a99ef28297..1f2cef1258f70 100644 --- a/docs/concepts/otlp/forwarding/pipelines/sentry-exporter.mdx +++ b/docs/concepts/otlp/forwarding/pipelines/sentry-exporter.mdx @@ -74,15 +74,8 @@ In your Sentry account, go to **[General Settings](https://sentry.io/orgredirect ## Basic Configuration - - - - By default, the exporter routes telemetry based on `service.name`. A service with `service.name: payments-api` sends to a Sentry project with slug `payments-api`. - - - ```yaml {filename:otel-collector-config.yaml} receivers: otlp: @@ -113,16 +106,8 @@ service: exporters: [sentry] ``` - - - - ## Routing Options - - - - ### Automatic Project Creation When services spin up dynamically (Kubernetes deployments, serverless functions), you may not have pre-created Sentry projects. Enable `auto_create_projects` to provision them on-demand. @@ -132,9 +117,6 @@ When services spin up dynamically (Kubernetes deployments, serverless functions) may be dropped while provisioning completes. - - - ```yaml exporters: sentry: @@ -142,21 +124,12 @@ exporters: auto_create_projects: true ``` - - - - - - ### Custom Project Mapping When your service names don't match your Sentry project slugs (legacy naming, organizational conventions), map them explicitly. Services not in the mapping fall back to using `service.name` as the project slug. - - - ```yaml exporters: sentry: @@ -168,19 +141,10 @@ exporters: api-gateway: ecommerce-gateway ``` - - - - - - ### Routing by Different Attributes Route by environment, team, or any other resource attribute instead of service name. - - - ```yaml exporters: sentry: @@ -192,10 +156,6 @@ exporters: staging: staging-monitoring ``` - - - - ## Rate Limiting The exporter respects Sentry's rate limits automatically: diff --git a/docs/concepts/otlp/forwarding/pipelines/vector.mdx b/docs/concepts/otlp/forwarding/pipelines/vector.mdx index 729b3754c0929..467c6326ec324 100644 --- a/docs/concepts/otlp/forwarding/pipelines/vector.mdx +++ b/docs/concepts/otlp/forwarding/pipelines/vector.mdx @@ -16,15 +16,8 @@ Before you begin, ensure you have: ## Step 1: Get Your Sentry OTLP Credentials - - - - Find these in [Sentry Project Settings](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/:projectId/keys/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)**. - - - ```bash # Logs endpoint ___OTLP_LOGS_URL___ @@ -33,10 +26,6 @@ ___OTLP_LOGS_URL___ x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___ ``` - - - - ## Step 2: Configure Vector Choose your configuration based on your data source: @@ -46,10 +35,6 @@ Choose your configuration based on your data source: ## Option A: Forwarding OTLP Data - - - - If you're receiving data that's already in OTLP format (from an OpenTelemetry SDK or collector), you can forward it directly to Sentry using the `otlp` codec without any transformation. @@ -58,9 +43,6 @@ The `otlp` codec requires Vector version [0.51.0](https://vector.dev/releases/0. - - - ```yaml {filename:vector.yaml} sources: otel_source: @@ -86,10 +68,6 @@ sinks: codec: otlp ``` - - - - ## Option B: Transforming Non-OTLP Data If your logs come from non-OTLP sources (files, syslog, etc.), you need to use a [remap transform](https://vector.dev/docs/reference/configuration/transforms/remap/) with VRL (Vector Remap Language) to convert your data into the OTEL format before sending to Sentry. @@ -127,10 +105,6 @@ The OpenTelemetry log format requires a specific structure with `resourceLogs`, ### Example: Forwarding File Logs - - - - This example reads logs from a file and forwards them to Sentry. The remap transform: @@ -139,9 +113,6 @@ The remap transform: - Maps file metadata to attributes - Cleans up original fields - - - ```yaml {filename:vector.yaml} sources: app_logs: @@ -202,16 +173,8 @@ sinks: codec: otlp ``` - - - - ### Example: Forwarding Syslog - - - - For syslog data, you can map severity levels to OTEL severity. The remap transform: @@ -219,9 +182,6 @@ The remap transform: - Preserves syslog metadata as attributes - Handles the syslog-specific fields - - - ```yaml {filename:vector.yaml} sources: syslog_input: @@ -299,10 +259,6 @@ sinks: codec: otlp ``` - - - - ## VRL Remap Reference Here are the key VRL functions you'll use when building OTEL log records: diff --git a/docs/platforms/dart/common/index.mdx b/docs/platforms/dart/common/index.mdx index 8cb3ec4aa923a..a15ba542b8fb8 100644 --- a/docs/platforms/dart/common/index.mdx +++ b/docs/platforms/dart/common/index.mdx @@ -24,24 +24,13 @@ This guide focuses on plain Dart. If you're building a Flutter app, use the dedi ## Install - - - - Add the Sentry Dart SDK to your `pubspec.yaml`: - - - ```yml {filename:pubspec.yaml} dependencies: sentry: ^{{@inject packages.version('sentry.dart') }} ``` - - - - ## Configure Choose the features you want to configure, and this guide will show you how: @@ -54,15 +43,8 @@ Choose the features you want to configure, and this guide will show you how: Configuration should happen as **early as possible** in your application's lifecycle. - - - - Import and initialize the SDK in your app's entry point: - - - ```dart import 'package:sentry/sentry.dart'; @@ -84,25 +66,14 @@ Future main() async { } ``` - - - - ## Verify Your Setup Let's test your setup and confirm that data reaches your Sentry project. ### Issues - - - - To verify that Sentry captures errors and creates issues in your Sentry project, add this intentional error to your application: - - - ```dart import 'package:sentry/sentry.dart'; @@ -116,10 +87,6 @@ try { } ``` - - - - diff --git a/docs/platforms/dart/common/tracing/streamed-spans/index.mdx b/docs/platforms/dart/common/tracing/streamed-spans/index.mdx index 01c455fadffc5..c0df776307acf 100644 --- a/docs/platforms/dart/common/tracing/streamed-spans/index.mdx +++ b/docs/platforms/dart/common/tracing/streamed-spans/index.mdx @@ -67,23 +67,12 @@ Follow ___CURRENT_URL___ to migrate custom instrumentation and filtering to span ## Configuration - - - - Configure tracing with `tracesSampleRate` or `tracesSampler`. No additional lifecycle setting is required. - - - - - - - To opt out of span streaming, set `options.traceLifecycle = SentryTraceLifecycle.static`. Transaction mode supports `beforeSendTransaction` and `ignoreTransactions`; these options have no effect in stream mode. Use only the APIs for the tracing mode you choose. Calls to APIs from the other mode are ignored: @@ -122,15 +111,8 @@ The SDK instruments common operations for you, but you can wrap your own code in ### Start a Span - - - - Use `Sentry.startSpan` to create a span that ends automatically when the callback completes: - - - ```dart final result = await Sentry.startSpan( 'my-operation', @@ -144,16 +126,8 @@ final result = await Sentry.startSpan( ); ``` - - - - - Child spans created inside the callback are automatically associated with the parent through zones: - - - ```dart await Sentry.startSpan('parent-operation', (_) async { await Sentry.startSpan('child-step-1', (_) async { @@ -166,19 +140,11 @@ await Sentry.startSpan('parent-operation', (_) async { }); ``` - - - - - By default, a span inherits the currently active span as its parent. To change this, pass `parentSpan`: - `parentSpan: null` forces a service span with no local parent. - `parentSpan: someSpan` parents the new span under a specific span. - - - ```dart // force a new service span await Sentry.startSpan( @@ -210,44 +176,22 @@ try { } ``` - - - - #### Create Spans for Synchronous Work - - - - `Sentry.startSpan` takes an asynchronous callback (returning `Future`). For synchronous work, use `Sentry.startSpanSync`, which takes a synchronous callback (returning `T`). Both variants can be freely nested, and parent-child relationships resolve correctly across sync and async boundaries: - - - ```dart final config = Sentry.startSpanSync('parse-config', (_) { return Config.parse(raw); }); ``` - - - - If a span isn't sampled, the callback still runs and receives a no-op span, so all span operations remain safe to call. #### Create Spans That Outlive a Callback - - - - Use `Sentry.startInactiveSpan` when the work can't be wrapped in a single callback — widget lifecycles, stream subscriptions, or platform channel round-trips. You have to call `end()` manually, and other spans do **not** automatically become its children — to nest a span under it, pass it explicitly via `parentSpan` when starting the child. - - - ```dart final paymentSpan = Sentry.startInactiveSpan( 'payment', @@ -260,21 +204,10 @@ void onPaymentComplete() { } ``` - - - - #### Retroactively Set Span Timing - - - - When the real start or end of the work happened before you could create or end the span (for example, a duration measured by a platform channel) pass `startTimestamp` or an explicit `end` time: - - - ```dart // startTimestamp is available on the callback variants Sentry.startSpanSync('replay-import', (_) => importRows(), @@ -285,18 +218,10 @@ final paymentSpan = Sentry.startInactiveSpan('payment'); paymentSpan.end(endTimestamp: nativeEnd); ``` - - - - ## Add Attributes Attach structured metadata to spans using typed `SentryAttribute` values. - - - - You can set attributes when starting a span: @@ -305,9 +230,6 @@ Sentry automatically sets several standard attributes on spans. To avoid acciden - - - ```dart await Sentry.startSpan( 'process-order', @@ -323,16 +245,8 @@ await Sentry.startSpan( ); ``` - - - - - Or add them to an already running span with `setAttribute` or `setAttributes`. Use `removeAttribute` to remove an attribute: - - - ```dart await Sentry.startSpan('handle-request', (span) async { span.setAttribute( @@ -349,10 +263,6 @@ await Sentry.startSpan('handle-request', (span) async { }); ``` - - - - Each attribute value is created with a typed `SentryAttribute` factory: @@ -411,36 +321,18 @@ You can shape what ends up in Sentry by filtering span data or dropping spans en ### Filter Spans - - - - To modify or redact span data before it's sent, use `beforeSendSpan`: - - - ```dart options.beforeSendSpan = (span, hint) { span.removeAttribute('http.request.body'); }; ``` - - - - ### Drop Spans - - - - To prevent specific spans from being sent, use `ignoreSpans`. Rules are evaluated at span start and match against the span name. Attribute-based matching is not yet supported. - - - ```dart options.ignoreSpans = [ IgnoreSpanRule.nameEquals('health-check'), @@ -450,10 +342,6 @@ options.ignoreSpans = [ ]; ``` - - - - | Factory | Matches | @@ -471,15 +359,8 @@ When an ignored span has children, the children are re-parented to the nearest r If you use `tracesSampleRate`, no changes are needed — it works the same way in stream mode. - - - - If you use a custom `tracesSampler`, the shape of the sampling context is different in stream mode. Instead of a transaction context, read the span's `name` and `attributes` from `samplingContext.spanContext`: - - - ```dart options.tracesSampler = (samplingContext) { final spanContext = samplingContext.spanContext; @@ -490,10 +371,6 @@ options.tracesSampler = (samplingContext) { }; ``` - - - - Only service spans are sampled and child spans inherit the service span's decision. When a service span isn't sampled, its callback still executes with a no-op span, so all span operations remain safe to call. ## Distributed Tracing (Optional) diff --git a/docs/platforms/dart/guides/flutter/index.mdx b/docs/platforms/dart/guides/flutter/index.mdx index 7a590f8d3b7e6..236116b398d18 100644 --- a/docs/platforms/dart/guides/flutter/index.mdx +++ b/docs/platforms/dart/guides/flutter/index.mdx @@ -21,15 +21,8 @@ categories: Sentry captures data by using an SDK within your application's runtime. - - - - We recommend installing the SDK through our [Sentry Wizard](https://github.com/getsentry/sentry-wizard). Run one of the following commands inside your project directory: - - - ```bash {tabTitle:brew} {mdExpandTabs} brew install getsentry/tools/sentry-wizard && sentry-wizard -i flutter ``` @@ -72,10 +65,6 @@ chmod +x sentry-wizard npx @sentry/wizard@latest -i flutter ``` - - - - This will patch your project and configure the SDK. You only need to patch the project once, then you can add the patched files to your version control system. If you prefer, you can also [set up the SDK manually](/platforms/dart/guides/flutter/manual-setup/). @@ -102,23 +91,12 @@ Let's test your setup and confirm that data reaches your Sentry project. ### Issues - - - - The wizard added a sample exception to `main.dart` that is captured when the app starts. Run your app to send it to Sentry: - - - ```bash flutter run ``` - - - - After you've confirmed the issue in Sentry, remove the sample exception from `main.dart` so it isn't captured on every launch. diff --git a/docs/platforms/dart/guides/flutter/manual-setup.mdx b/docs/platforms/dart/guides/flutter/manual-setup.mdx index 2e59542fe955a..29fb4440898c6 100644 --- a/docs/platforms/dart/guides/flutter/manual-setup.mdx +++ b/docs/platforms/dart/guides/flutter/manual-setup.mdx @@ -12,24 +12,13 @@ If you can't (or prefer not to) run the [automatic setup](/platforms/dart/guides ## Install - - - - Add the Sentry Flutter SDK to your `pubspec.yaml`: - - - ```yml {filename:pubspec.yaml} dependencies: sentry_flutter: ^{{@inject packages.version('sentry.dart.flutter') }} ``` - - - - ### Apple Platform Setup The Flutter plugin installs the native Sentry SDK through Swift Package Manager. CocoaPods is not supported for this plugin. @@ -59,15 +48,8 @@ Choose the features you want to configure, and this guide will show you how: Configuration should happen as **early as possible** in your application's lifecycle. Logs and metrics are enabled by default; use `Sentry.logger` and `Sentry.metrics` after initialization without an enable flag. - - - - Import and initialize the SDK in your app's `main` function: - - - ```dart import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; @@ -102,25 +84,14 @@ Future main() async { } ``` - - - - ## Verify Your Setup Let's test your setup and confirm that data reaches your Sentry project. ### Issues - - - - To verify that Sentry captures errors and creates issues in your Sentry project, add this intentional error to your application: - - - ```dart import 'package:sentry_flutter/sentry_flutter.dart'; @@ -134,10 +105,6 @@ try { } ``` - - - - diff --git a/docs/platforms/javascript/common/logs/index.mdx b/docs/platforms/javascript/common/logs/index.mdx index e423e3f1fd146..8b0c66648def5 100644 --- a/docs/platforms/javascript/common/logs/index.mdx +++ b/docs/platforms/javascript/common/logs/index.mdx @@ -14,18 +14,10 @@ Sentry Logs are **high-cardinality** — you can pass any attributes you want an - - - - - ## Setup Logs are enabled by default. Just initialize the SDK and use `Sentry.logger` to send logs. - - - ```javascript @@ -48,12 +40,6 @@ export default defineCloudflareOptions((env) => ({ - - - - - - ## Send Logs Use `Sentry.logger` to send logs at different levels. A log message is required for Sentry to send the log. @@ -67,9 +53,6 @@ Use `Sentry.logger` to send logs at different levels. A log message is required | `error` | Failures that need attention | | `fatal` | Critical failures, system down | - - - ```javascript Sentry.logger.trace("Entering function", { fn: "processOrder" }); Sentry.logger.debug("Cache lookup", { key: "user:123" }); @@ -79,21 +62,12 @@ Sentry.logger.error("Payment failed", { reason: "card_declined" }); Sentry.logger.fatal("Database unavailable", { host: "primary" }); ``` - - - - - - ## Add Context Pass structured data as the second argument — these attributes become searchable columns in Sentry. Use `Sentry.logger.fmt` for parameterized messages. Values are automatically extracted as searchable attributes. - - - ```javascript // Pass attributes directly Sentry.logger.info("User signed up", { @@ -108,12 +82,6 @@ const productName = "Widget Pro"; Sentry.logger.info(Sentry.logger.fmt`User ${userId} purchased ${productName}`); ``` - - - - - - ## Shared Attributes @@ -124,9 +92,6 @@ To attach attributes to a broader or narrower context, set them on a specific sc See Attributes for more information. - - - ```javascript // Applied to all logs and metrics Sentry.setAttributes({ @@ -148,12 +113,6 @@ Sentry.withScope((scope) => { }); ``` - - - - - - ## Console Integration Already using `console.log`? Capture console calls as Sentry Logs with `consoleLoggingIntegration`. @@ -162,9 +121,6 @@ Multiple arguments are parsed as searchable attributes (requires SDK `10.13.0`+) For [Consola](https://github.com/unjs/consola) users, use `Sentry.createConsolaReporter()` instead (requires SDK `10.12.0`+). - - - ```javascript @@ -206,21 +162,12 @@ export default defineCloudflareOptions((env) => ({ - - - - - - ## Filter Logs Use `beforeSendLog` to filter or modify logs before they're sent. Return `null` to drop a log. The log object includes: `level`, `message`, `timestamp`, and `attributes`. - - - ```javascript @@ -269,11 +216,6 @@ export default defineCloudflareOptions((env) => ({ - - - - - ## How Logs Link to Other Features Everything in Sentry is linked by trace. When you're viewing a log, you can jump to the parent trace to see the full request context. When you're viewing a trace, you can see all logs emitted during that operation. This connection makes it easy to move between high-level performance data and detailed diagnostic logs. diff --git a/docs/platforms/javascript/common/session-replay/index.mdx b/docs/platforms/javascript/common/session-replay/index.mdx index 84f865183e6be..f3229d5070955 100644 --- a/docs/platforms/javascript/common/session-replay/index.mdx +++ b/docs/platforms/javascript/common/session-replay/index.mdx @@ -72,35 +72,18 @@ Session Replay only runs in the browser, so you only need to configure it in `in There is currently no PII scrubbing in canvas recordings! - - - - - #### Enable Canvas Recording Add `replayCanvasIntegration()` to record HTML canvas elements. This is opt-in and tree-shaken from your bundle if not used. - - - - - - - - - #### 3D and WebGL Canvases For 3D/WebGL canvases, the integration needs `preserveDrawingBuffer` to export images, which can affect performance. To avoid this, enable manual snapshotting and call `snapshot()` inside your paint loop. Call `snapshot()` in the same execution loop as draw commands to avoid capturing empty buffers. - - - ```javascript // Step 1: Enable manual snapshotting Sentry.replayCanvasIntegration({ @@ -116,19 +99,10 @@ function paint() { } ``` - - - - - - #### WebGPU Canvases WebGPU canvas textures expire after the current task completes. Use `skipRequestAnimationFrame: true` to capture immediately after rendering. - - - ```javascript // Step 1: Enable manual snapshotting Sentry.replayCanvasIntegration({ @@ -150,19 +124,10 @@ function paint() { } ``` - - - - ### Content Security Policy (CSP) - - - - - #### Configure CSP for Replay Session Replay uses a WebWorker for compression off the main UI thread. Add these CSP entries to allow workers to load. @@ -173,19 +138,11 @@ Safari versions ≤ 15.4 also need `child-src`. - - - ```text worker-src 'self' blob: child-src 'self' blob: ``` - - - - - If you're unable to update your CSP policy to allow inline web workers, you can also [use a custom compression worker](./configuration/#using-a-custom-compression-worker) instead. @@ -216,11 +173,6 @@ If you prefer not to record an entire session, you can elect to capture a replay Sampling controls how much traffic results in a Session Replay. - - - - - #### Configure Sample Rates - - Percentage of sessions to record fully @@ -240,9 +192,6 @@ Sampling controls how much traffic results in a Session Replay. - - - ```javascript {filename:instrumentation-client.ts} Sentry.init({ dsn: "___PUBLIC_DSN___", @@ -257,11 +206,6 @@ Sentry.init({ }); ``` - - - - - ### How Sampling Works Sampling begins as soon as a session starts. When someone visits your application, sampling decisions happen in this order: diff --git a/docs/platforms/javascript/common/tracing/streamed-spans/index__v10.x.mdx b/docs/platforms/javascript/common/tracing/streamed-spans/index__v10.x.mdx index b11a53698d866..6f05a18b2ab64 100644 --- a/docs/platforms/javascript/common/tracing/streamed-spans/index__v10.x.mdx +++ b/docs/platforms/javascript/common/tracing/streamed-spans/index__v10.x.mdx @@ -100,15 +100,8 @@ Each flush sends only the spans accumulated since the last flush, grouped into e ### Start a Span - - - - Use `Sentry.startSpan()` to create a span that is automatically ended when the callback completes: - - - ```javascript const result = await Sentry.startSpan( { name: "my-operation", attributes: { "my.attribute": "value" } }, @@ -119,17 +112,8 @@ const result = await Sentry.startSpan( ); ``` - - - - - - Child spans created inside the callback are automatically associated with the parent: - - - ```javascript await Sentry.startSpan({ name: "parent-operation" }, async () => { await Sentry.startSpan({ name: "child-step-1" }, async () => { @@ -142,25 +126,14 @@ await Sentry.startSpan({ name: "parent-operation" }, async () => { }); ``` - - - - For more details on span creation APIs, such as `startSpan`, `startSpanManual`, or `startInactiveSpan`, see Instrumentation. ## Add Attributes Attach structured metadata to spans using `attributes`, which can be `string`, `number`, or `boolean`, as well as arrays of these types. - - - - You can set attributes when starting a span: - - - ```javascript Sentry.startSpan( { @@ -178,17 +151,8 @@ Sentry.startSpan( ); ``` - - - - - - Or add them to an already running span: - - - ```javascript Sentry.startSpan({ name: "handle-request" }, (span) => { // Set a single attribute @@ -202,13 +166,8 @@ Sentry.startSpan({ name: "handle-request" }, (span) => { }); ``` - - - For examples, see Adding Span Attributes. - - ### Shared Attributes Previously, transaction mode applied shared tags (`Sentry.setTag(s)`) to the service span (transaction). @@ -217,10 +176,6 @@ Set shared attributes on a specific scope instead. You don't need to remove tags from your code, since they still apply to errors. Instead, add attributes for all data that's relevant for spans, logs metrics. - - - - Use `Sentry.setAttribute` and `Sentry.setAttributes` to attach attributes that are automatically included in all spans (as well as your logs and metrics). These work just like `Sentry.setTag` and `Sentry.setTags`, but they accept `string`, `number`, and `boolean` values. @@ -228,9 +183,6 @@ To attach attributes to a broader or narrower context, set them on a specific sc See Attributes for more information. - - - ```javascript // Applied to all spans, logs and metrics Sentry.setAttributes({ @@ -252,10 +204,6 @@ Sentry.withScope((scope) => { }); ``` - - - - ## Breadcrumbs In stream mode, breadcrumbs are no longer sent with spans. @@ -265,10 +213,6 @@ They remain attached to errors, so you don't need to change how you record them. ### Filter Spans - - - - To modify or redact span data before it's sent, use `beforeSendSpan`. In stream mode, wrap it with `Sentry.withStreamedSpan()` so the SDK applies it to spans as they are flushed rather than only at transaction time. @@ -278,9 +222,6 @@ To modify or redact span data before it's sent, use - - ```JavaScript @@ -327,10 +268,6 @@ Sentry.init({ - - - - If you're using `beforeSendSpan`, wrap it with `Sentry.withStreamedSpan()` as shown above, otherwise the SDK falls back to transaction mode. @@ -353,15 +290,8 @@ If you're using `beforeSendTransaction` to drop spans, use [`ignoreSpans`](#drop In stream mode, `ignoreSpans` is evaluated at span start, so only the span name and attributes available at that point are taken into account. Any name updates or additional attributes added while the span is active won't influence whether the span is dropped. - - - - To prevent specific spans from being created, use the `ignoreSpans` option: - - - ```javascript @@ -419,10 +349,6 @@ Sentry.init({ - - - - If a matching span is a service span, all of its child spans are dropped as well. If a child span matches, only that span is dropped and its children are reparented to the nearest ancestor. diff --git a/docs/platforms/javascript/guides/angular/index.mdx b/docs/platforms/javascript/guides/angular/index.mdx index 6416ff0e830b9..a16215e9b8f88 100644 --- a/docs/platforms/javascript/guides/angular/index.mdx +++ b/docs/platforms/javascript/guides/angular/index.mdx @@ -25,24 +25,12 @@ at least Angular 17. ## Install - - - - Run the Sentry wizard to automatically configure Sentry in your Angular application. It will then guide you through the setup process, asking you to enable additional (optional) Sentry features for your application beyond error monitoring. - - - - ```bash npx @sentry/wizard@latest -i angular ``` - - - - This guide assumes that you enable all features and allow the wizard to add an example component to your application. You can add or remove features at any time, but setting them up now will save you the effort of configuring them manually later. diff --git a/docs/platforms/javascript/guides/angular/manual-setup.mdx b/docs/platforms/javascript/guides/angular/manual-setup.mdx index 9f04c928e159c..e191d042612c7 100644 --- a/docs/platforms/javascript/guides/angular/manual-setup.mdx +++ b/docs/platforms/javascript/guides/angular/manual-setup.mdx @@ -23,20 +23,10 @@ You need: ## Install - - - - - - Run the command for your preferred package manager to add the Sentry SDK to your application. If you're updating your Sentry SDK to the latest version, check out our migration guide to learn more about breaking changes. - - - - ```bash {tabTitle:npm} npm install @sentry/angular --save ``` @@ -49,10 +39,6 @@ yarn add @sentry/angular pnpm add @sentry/angular ``` - - - - In its current major version, the Sentry Angular SDK supports Angular 14 and newer. @@ -94,18 +80,8 @@ Choose the features you want to configure, and this guide will show you how: ### Initialize the SDK - - - - - - The main configuration should happen as early as possible in your app's lifecycle. Typically that means in your `main.ts` file. - - - - ```typescript {tabTitle: App Config} {mdExpandTabs} {filename: main.ts} {5-41} import { bootstrapApplication } from "@angular/platform-browser"; import { appConfig } from "./app/app.config"; @@ -219,18 +195,8 @@ platformBrowserDynamic() .catch((err) => console.error(err)); ``` - - - - ### Register Sentry Providers - - - - - - The Sentry Angular SDK exports a couple of Angular providers that are necessary to fully instrument your application. We recommend registering them in your `app.config.ts` or main `app.module.ts`: @@ -239,10 +205,6 @@ If your Angular app is configured for SSR, make sure that the Sentry providers a - - - - ```typescript {tabTitle: App Config (Angular 19+)} {mdExpandTabs} {filename: app.config.ts} {9, 14-25} import { ApplicationConfig, @@ -338,10 +300,6 @@ import * as Sentry from "@sentry/angular"; export class AppModule {} ``` - - - - @@ -379,10 +337,6 @@ Let's test your setup and confirm that Sentry is working correctly and sending d ### Issues - - - - To verify that Sentry captures errors and creates issues in your Sentry project, add the following test button to one of your components (e.g. `app.component.ts`), which will trigger an error that Sentry will capture when you click it. @@ -391,10 +345,6 @@ To verify that Sentry captures errors and creates issues in your Sentry project, - - - - ```javascript {filename: app.component.ts} {5, 9-11} @Component({ selector: "app-root", @@ -410,25 +360,13 @@ class AppComponent { } ``` - - - - ### Tracing - - - - To test your tracing configuration, update the previous code snippet to start a trace to measure the time it takes to execute your code. Open the page in a browser and click the button to trigger a frontend error and performance trace. - - - - ```javascript {filename: app.component.ts} {10-11, 13-14} @Component({ selector: "app-root", @@ -448,10 +386,6 @@ class AppComponent { } ``` - - - - diff --git a/docs/platforms/javascript/guides/azure-functions/index.mdx b/docs/platforms/javascript/guides/azure-functions/index.mdx index c15efbdf34fbc..731574513496e 100644 --- a/docs/platforms/javascript/guides/azure-functions/index.mdx +++ b/docs/platforms/javascript/guides/azure-functions/index.mdx @@ -25,32 +25,14 @@ Choose the features you want to configure, and this guide will show you how: ### Install the Sentry SDK - - - - Run the command for your preferred package manager to add `@sentry/node` as a runtime dependency to your application: - - - - - - - ## Configure - - - - Make sure to initialize Sentry at the top of your function file before importing any other modules: - - - ```javascript {tabTitle:async} const Sentry = require("@sentry/node"); // ___PRODUCT_OPTION_START___ profiling @@ -85,21 +67,10 @@ Sentry.init({ // your function code ``` - - - - ### Capture Errors - - - - Because Azure Functions are short-lived, you have to explicitly `flush` Sentry events after calling `captureException`, or they may be lost before being sent to Sentry. - - - ```javascript {tabTitle:async} const Sentry = require("@sentry/node"); @@ -121,10 +92,6 @@ module.exports = async function (context, req) { }; ``` - - - - ### Add Readable Stack Traces With Source Maps (Optional) @@ -139,15 +106,8 @@ Let's test your setup and confirm that Sentry is working correctly and sending d ### Issues - - - - Let's verify that Sentry captures errors and creates issues in your Sentry project. Add an intentional error in your function: - - - ```javascript {tabTitle:async} const Sentry = require("@sentry/node"); @@ -172,21 +132,11 @@ module.exports = async function (context, req) { }; ``` - - - - ### Tracing - - - To test tracing, update your function to include a custom span: - - - ```javascript {tabTitle:async} const Sentry = require("@sentry/node"); @@ -206,10 +156,6 @@ module.exports = async function (context, req) { }; ``` - - - - diff --git a/docs/platforms/javascript/guides/bun/index.mdx b/docs/platforms/javascript/guides/bun/index.mdx index d70ce4d8aa9ac..ba7b0ba8e49a6 100644 --- a/docs/platforms/javascript/guides/bun/index.mdx +++ b/docs/platforms/javascript/guides/bun/index.mdx @@ -23,37 +23,19 @@ Choose the features you want to configure, and this guide will show you how: ### Install the SDK - - - - Use the Bun package manager to add the Sentry SDK to your application: - - - ```bash {tabTitle:Bun} bun add @sentry/bun ``` - - - - ## Configure ### Initialize the Sentry SDK - - - - Sentry should be initialized as early in your app as possible. Create a file named `instrument.js` in the root directory of your project and add the following code: - - - ```javascript {filename: instrument.js} import * as Sentry from "@sentry/bun"; @@ -73,23 +55,12 @@ Sentry.init({ }); ``` - - - - ### Build With the Sentry Plugin (Recommended) - - - - We recommend building with the Sentry plugin, because it adds spans from your dependencies, such as database drivers, AI SDKs, and web frameworks like Express, Koa and Hapi. Bun has no runtime hook Sentry can use to instrument those packages, so the plugin rewrites them as `bun build` bundles them. Add `sentryBunPlugin` from `@sentry/bun/plugin` to your `Bun.build()` call, then run the output the same way, with `--preload`. Errors, the spans you create yourself, and `Bun.serve`, `node:http` and `fetch` spans work either way. - - - ```typescript {filename:build.ts} import { sentryBunPlugin } from "@sentry/bun/plugin"; @@ -101,21 +72,10 @@ await Bun.build({ }); ``` - - - - ### Apply Instrumentation to Your App - - - - Preload your instrumentation file with the [`--preload`](https://bun.com/docs/runtime#param-preload) flag. This is what guarantees that `Sentry.init()` runs before any other module is loaded. - - - ```bash {tabTitle:From source} bun --preload ./instrument.js app.js ``` @@ -124,10 +84,6 @@ bun --preload ./instrument.js app.js bun --preload ./instrument.js dist/app.js ``` - - - - ### Add Readable Stack Traces With Source Maps (Optional) @@ -142,15 +98,8 @@ Let's test your setup and confirm that Sentry is working correctly and sending d ### Issues - - - - First, let's verify that Sentry captures errors and creates issues in your Sentry project. Add the following code snippet to your main application file, which will call an undefined function, triggering an error that Sentry will capture: - - - ```javascript setTimeout(() => { try { @@ -161,22 +110,11 @@ setTimeout(() => { }, 99); ``` - - - - ### Tracing - - - - To test your tracing configuration, update the previous code snippet by starting a trace to measure the time it takes for the execution of your code: - - - ```javascript Sentry.startSpan( { @@ -195,10 +133,6 @@ Sentry.startSpan( ); ``` - - - - diff --git a/docs/platforms/javascript/guides/capacitor/index.mdx b/docs/platforms/javascript/guides/capacitor/index.mdx index e80630e6733c3..7b8dab639d01e 100644 --- a/docs/platforms/javascript/guides/capacitor/index.mdx +++ b/docs/platforms/javascript/guides/capacitor/index.mdx @@ -22,21 +22,10 @@ This guide will show you setup instructions for Angular, React, Vue, and Nuxt. I ### Install the Sentry SDK - - - - Run the command for your preferred package manager to add Sentry's Capacitor SDK and the SDK for the framework you're using to your application: - - - - - - - #### Angular @@ -74,23 +63,12 @@ Choose the features you want to configure, and this guide will show you how: ### Initialize the Sentry SDK - - - - Initialize Sentry as early as possible in your application's lifecycle. If you're using Angular, React, Vue, or Nuxt, make sure to forward the `init` method from the framework's Sentry SDK, as you can see in these code snippets. If you're following the vanilla setup, you don't need to do this. - - - - - - - ### Add Readable Stack Traces With Source Maps (Optional) @@ -109,10 +87,6 @@ Let's test your setup and confirm that Sentry is working correctly and sending d ### Issues - - - - To verify that Sentry captures errors and creates issues in your Sentry project, add the following test button and logic. @@ -121,9 +95,6 @@ To verify that Sentry captures errors and creates issues in your Sentry project, - - - ```javascript {tabTitle: Angular 12, 13, 14+} {mdExpandTabs} @Component({ selector: "app-root", @@ -187,24 +158,13 @@ export default { ``` - - - - ### Tracing - - - - To test your tracing configuration, update the previous code snippet and wrap the error in a custom span. Then, open the page in a browser and click the button to trigger a frontend error and trace. - - - ```javascript {tabTitle: Angular 12, 13, 14+} {mdExpandTabs} import * as Sentry from "@sentry/capacitor"; @@ -292,10 +252,6 @@ export default { ``` - - - - diff --git a/docs/platforms/javascript/guides/cloudflare/features/pages.mdx b/docs/platforms/javascript/guides/cloudflare/features/pages.mdx index 1815e5364ca64..b750335e57c4c 100644 --- a/docs/platforms/javascript/guides/cloudflare/features/pages.mdx +++ b/docs/platforms/javascript/guides/cloudflare/features/pages.mdx @@ -28,17 +28,10 @@ Cloudflare Pages applications are instrumented with the `sentryPagesPlugin` midd ### Add the Middleware - - - - To use the Sentry SDK, add the `sentryPagesPlugin` as [middleware to your Cloudflare Pages application](https://developers.cloudflare.com/pages/functions/middleware/). - - - ```javascript {filename:functions/_middleware.js} import * as Sentry from "@sentry/cloudflare"; @@ -56,20 +49,10 @@ export const onRequest = [ ]; ``` - - - - - - - If you don't have access to the `onRequest` middleware API, you can use the `wrapRequestHandler` API instead. For example: - - - ```javascript // hooks.server.js import { wrapRequestHandler } from "@sentry/cloudflare/request"; @@ -87,10 +70,6 @@ export const handle = ({ event, resolve }) => { }; ``` - - - - ## Control the Data You Send to Sentry (Optional) @@ -115,25 +94,14 @@ For the full list of categories and their defaults, see the - - - To test your tracing configuration, start a span around the failing code: ```javascript {filename:debug-sentry.js} diff --git a/docs/platforms/javascript/guides/cloudflare/frameworks/astro.mdx b/docs/platforms/javascript/guides/cloudflare/frameworks/astro.mdx index d409e432b6b51..bd7fec2cc7944 100644 --- a/docs/platforms/javascript/guides/cloudflare/frameworks/astro.mdx +++ b/docs/platforms/javascript/guides/cloudflare/frameworks/astro.mdx @@ -36,18 +36,10 @@ The SDK reads standard Sentry environment variables including `SENTRY_DSN`, `SEN - - For Cloudflare Pages, you need to manually set up the `@sentry/cloudflare` SDK using the Pages middleware. - - - 1. Install both SDKs: - - - ```bash {tabTitle:npm} npm install @sentry/astro @sentry/cloudflare ``` @@ -60,17 +52,8 @@ yarn add @sentry/astro @sentry/cloudflare pnpm add @sentry/astro @sentry/cloudflare ``` - - - - - - 2. Add the Sentry Astro integration to your `astro.config.mjs`: - - - ```javascript {filename:astro.config.mjs} import { defineConfig } from "astro/config"; import cloudflare from "@astrojs/cloudflare"; @@ -82,17 +65,8 @@ export default defineConfig({ }); ``` - - - - - - 3. - - - ```javascript {filename:functions/_middleware.js} import * as Sentry from "@sentry/cloudflare"; @@ -106,17 +80,8 @@ export const onRequest = [ ]; ``` - - - - - - 4. Make sure to [configure Cloudflare for Sentry](/platforms/javascript/guides/cloudflare/#wrangler-configuration). - - - diff --git a/docs/platforms/javascript/guides/cloudflare/frameworks/hydrogen-react-router.mdx b/docs/platforms/javascript/guides/cloudflare/frameworks/hydrogen-react-router.mdx index f288e761527f2..fad55e7a83325 100644 --- a/docs/platforms/javascript/guides/cloudflare/frameworks/hydrogen-react-router.mdx +++ b/docs/platforms/javascript/guides/cloudflare/frameworks/hydrogen-react-router.mdx @@ -35,15 +35,8 @@ Choose the features you want to configure, and this guide will show you how: ### Install the Sentry SDK - - - - Run the command for your preferred package manager to add the React Router and Cloudflare SDK: - - - ```bash {tabTitle:npm} npm install @sentry/react-router @sentry/cloudflare --save ``` @@ -56,25 +49,14 @@ yarn add @sentry/react-router @sentry/cloudflare pnpm add @sentry/react-router @sentry/cloudflare ``` - - - - ## Configure ### Configure Client-side Sentry - - - - Initialize Sentry in your `entry.client.tsx` file. The `sentryOnError` handler integrates with React Router's [`onError` hook](https://reactrouter.com/how-to/error-reporting) to automatically capture and report client-side errors to Sentry. - - - ```tsx {filename: app/entry.client.tsx} import { HydratedRouter } from "react-router/dom"; import * as Sentry from "@sentry/react-router/cloudflare"; @@ -133,21 +115,10 @@ startTransition(() => { }); ``` - - - - ### Configure Server-side Sentry - - - - First, create an `instrument.server.mjs` file to initialize Sentry on the server: - - - ```js {filename:instrument.server.mjs} import * as Sentry from "@sentry/react-router"; @@ -166,12 +137,6 @@ Sentry.init({ }); ``` - - - - - - Next, update your `server.ts` file to use the `wrapRequestHandler` method from the `@sentry/cloudflare/request` subpath: @@ -186,9 +151,6 @@ On Shopify Oxygen, never import anything directly from `@sentry/cloudflare`. Onl - - - ```ts {filename:server.ts} import { wrapRequestHandler } from "@sentry/cloudflare/request"; // ...other imports @@ -231,23 +193,12 @@ export default { }; ``` - - - - ### Enable Distributed Tracing - - - - Update your `entry.server.tsx` file to inject trace meta tags: - - - ```tsx {filename:app/entry.server.tsx} import "./instrument.server"; import { HandleErrorFunction, ServerRouter } from "react-router"; @@ -289,25 +240,14 @@ export const handleError: HandleErrorFunction = (error, { request }) => { export default Sentry.wrapSentryHandleRequest(handleRequest); ``` - - - - ### Add Readable Stack Traces With Source Maps (Optional) - - - - The stack traces in your Sentry errors probably won't look like your actual code without unminifying them. To fix this, upload your source maps to Sentry. First, update `vite.config.ts` to include the `sentryReactRouter` plugin, making sure to pass both the Vite and Sentry configurations to it. - - - ```ts {filename:vite.config.ts} import { reactRouter } from "@react-router/dev/vite"; import { hydrogen } from "@shopify/hydrogen/vite"; @@ -336,17 +276,8 @@ export default defineConfig((config) => ({ })); ``` - - - - - - Since the `buildEnd` hook will not be executed for Hydrogen, you need to manually upload source maps using the [Sentry CLI](/cli/) instead. - - - ```bash # Inject debug IDs sentry-cli sourcemaps inject /path/to/build/dir @@ -354,10 +285,6 @@ sentry-cli sourcemaps inject /path/to/build/dir sentry-cli sourcemaps upload /path/to/build/dir ``` - - - - ### Control the Data You Send to Sentry (Optional) - - - To verify that Sentry captures errors and creates issues in your Sentry project, throw an error in a loader. Next, open the `/sentry-test` route in your browser, and you should trigger an error. - - - ```tsx {filename: app/routes/sentry-test.tsx} import type { Route } from "./+types/sentry-test"; @@ -397,24 +317,13 @@ export default function SentryTestPage() { } ``` - - - - ### Tracing - - - - To test your tracing configuration, update the previous code snippet by starting a trace to measure the time it takes for the execution of your code. Open the `/sentry-test` route in your browser. You should start a trace and trigger an error. - - - ```tsx {filename: app/routes/sentry-test.tsx} import * as Sentry from "@sentry/react-router/cloudflare"; import type { Route } from "./+types/sentry-test"; @@ -436,10 +345,6 @@ export default function SentryTestPage() { } ``` - - - - diff --git a/docs/platforms/javascript/guides/cloudflare/frameworks/remix.mdx b/docs/platforms/javascript/guides/cloudflare/frameworks/remix.mdx index 87b9c85bf2122..dc987930018ab 100644 --- a/docs/platforms/javascript/guides/cloudflare/frameworks/remix.mdx +++ b/docs/platforms/javascript/guides/cloudflare/frameworks/remix.mdx @@ -27,17 +27,10 @@ Choose the features you want to configure, and this guide will show you how: ### Install the Sentry SDK - - - - Run the command for your preferred package manager to add the Sentry Remix and Cloudflare SDKs to your application. With npm, add `--legacy-peer-deps`: `@remix-run/cloudflare` requires `@cloudflare/workers-types` version 4, while Wrangler 4 requires version 5. - - - ```bash {tabTitle:npm} npm install @sentry/remix @sentry/cloudflare --save --legacy-peer-deps ``` @@ -50,10 +43,6 @@ yarn add @sentry/remix @sentry/cloudflare pnpm add @sentry/remix @sentry/cloudflare ``` - - - - - - - Run the command for your preferred package manager to add the Sentry SDK to your application: - - - - - - - ## Configure When deploying TanStack Start to Cloudflare Workers, you need to wrap the server entry point with `Sentry.withSentry` from `@sentry/cloudflare`. TanStack Start allows you to create a custom server entry file for this purpose. @@ -58,10 +47,6 @@ When deploying TanStack Start to Cloudflare Workers, you need to wrap the server ### Create a Custom Server Entry - - - - Create a `src/server.ts` file that wraps the TanStack Start handler with Sentry. Use `wrapFetchWithSentry` from `@sentry/tanstackstart-react` to instrument TanStack Start server functions with tracing. @@ -72,9 +57,6 @@ Due to type differences between TanStack Start and Cloudflare Workers, you'll ne - - - ```typescript {filename:src/server.ts} import * as Sentry from "@sentry/cloudflare"; import { wrapFetchWithSentry } from "@sentry/tanstackstart-react"; @@ -95,21 +77,10 @@ export default Sentry.withSentry( ); ``` - - - - ### Update Wrangler Configuration - - - - Update your `wrangler.jsonc` (or `wrangler.toml`) to use your custom server entry: - - - ```json {diff} {filename:wrangler.jsonc} { "name": "my-tanstack-app", @@ -118,21 +89,10 @@ Update your `wrangler.jsonc` (or `wrangler.toml`) to use your custom server entr } ``` - - - - ### Configure Client-Side Sentry - - - - Initialize Sentry in your `src/router.tsx` file for client-side error tracking: - - - ```tsx {diff} {filename:src/router.tsx} +import * as Sentry from "@sentry/tanstackstart-react"; import { createRouter } from '@tanstack/react-router' @@ -177,16 +137,8 @@ export const getRouter = () => { } ``` - - - - ### Capture Server-Side Errors - - - - To capture server-side errors from HTTP requests and server function calls, add Sentry's global middlewares to `createStart()` in your `src/start.ts` file. The Sentry middleware should be the first middleware in the arrays to ensure all errors are captured. @@ -196,9 +148,6 @@ The Sentry middleware should be the first middleware in the arrays to ensure all `captureException` to manually capture those errors. - - - ```tsx {filename:src/start.ts} import { sentryGlobalFunctionMiddleware, @@ -214,10 +163,6 @@ export const startInstance = createStart(() => { }); ``` - - - - ### Add Readable Stack Traces With Source Maps (Optional) { ## Verify Your Setup - - - - To verify Sentry is capturing errors, add a test button to one of your pages: - - - ```tsx ``` - - - - - - Then, in your renderer, add the following: Finally, start your app and trigger two errors that Sentry will capture: one from the main process and one from the renderer. - - ```javascript document.getElementById("testError").addEventListener("click", () => { @@ -316,24 +216,13 @@ document.getElementById("testError").addEventListener("click", () => { }); ``` - - - - ### Tracing - - - - To test tracing in your renderer, start a trace to measure the time it takes to execute your code. Then, start your app and trigger two errors that Sentry will capture: one from the main process and one from the renderer. It will also start a trace with the defined name. - - - ```javascript document.getElementById("testError").addEventListener("click", () => { Sentry.startSpan({ op: "test", name: "Renderer test span" }, () => { @@ -342,10 +231,6 @@ document.getElementById("testError").addEventListener("click", () => { }); ``` - - - - diff --git a/docs/platforms/javascript/guides/elysia/index.mdx b/docs/platforms/javascript/guides/elysia/index.mdx index d9a6b4ca920c9..7e1cf220de0a0 100644 --- a/docs/platforms/javascript/guides/elysia/index.mdx +++ b/docs/platforms/javascript/guides/elysia/index.mdx @@ -37,10 +37,6 @@ Choose the features you want to configure, and this guide will show you how: ### Install the Sentry SDK - - - - Run the command for your runtime and preferred package manager to add the Sentry SDK to your application: @@ -48,9 +44,6 @@ Run the command for your runtime and preferred package manager to add the Sentry handles all instrumentation natively. - - - ```bash {tabTitle:Bun} {mdExpandTabs} bun add @sentry/elysia ``` @@ -63,21 +56,10 @@ yarn add @sentry/elysia @elysiajs/node pnpm add @sentry/elysia @elysiajs/node ``` - - - - ## Configure - - - - Call `Sentry.init()` before creating your Elysia app, then wrap the app with `Sentry.withElysia()` before defining routes. - - - ```javascript {tabTitle:Bun} {mdExpandTabs} {filename: index.ts} import * as Sentry from "@sentry/elysia"; import { Elysia } from "elysia"; @@ -125,22 +107,11 @@ const app = Sentry.withElysia(new Elysia({ adapter: node() })) .listen(3000); ``` - - - - ### Customize Automatic Error Capturing (Optional) - - - - The SDK captures 5xx errors automatically via a global `onError` hook. Client errors (3xx/4xx) are not captured by default. You can customize which errors are captured using the `shouldHandleError` option. - - - ```javascript const app = Sentry.withElysia(new Elysia(), { shouldHandleError: (context) => { @@ -150,10 +121,6 @@ const app = Sentry.withElysia(new Elysia(), { }); ``` - - - - ### Add Readable Stack Traces With Source Maps (Optional) @@ -168,38 +135,20 @@ Let's test your setup and confirm that Sentry is working correctly and sending d ### Issues - - - - First, let's verify that Sentry captures errors and creates issues in your Sentry project. Add the following route to your app, which triggers an error that Sentry will capture: - - - ```javascript app.get("/debug-sentry", () => { throw new Error("My first Sentry error!"); }); ``` - - - - ### Tracing - - - - To test your tracing configuration, update the previous code snippet by starting a trace to measure the time it takes for the execution of your code: - - - ```javascript app.get("/debug-sentry", async () => { await Sentry.startSpan( @@ -215,10 +164,6 @@ app.get("/debug-sentry", async () => { }); ``` - - - - diff --git a/docs/platforms/javascript/guides/ember/index.mdx b/docs/platforms/javascript/guides/ember/index.mdx index 93e9edc4cd3c9..ba92dfd4ed7fa 100644 --- a/docs/platforms/javascript/guides/ember/index.mdx +++ b/docs/platforms/javascript/guides/ember/index.mdx @@ -15,21 +15,10 @@ categories: ### Install the Sentry SDK - - - - Run the command for your preferred package manager to add the Sentry SDK to your application: - - - - - - - ## Configure **Error Monitoring** starts working as soon as you call `Sentry.init()`. **Logs** and **Application Metrics** need no extra configuration, and you'll learn how to send them in steps [#3](#send-logs) and [#4](#send-application-metrics-). @@ -39,10 +28,6 @@ This guide also enables **Tracing**, **Session Replay**, and **User Feedback**. ### Initialize the SDK - - - - Call `Sentry.init()` in `app/app.ts` before defining your `Application` class. The snippet also turns on: @@ -53,9 +38,6 @@ The snippet also turns on: Don't need a feature? Remove its integration and options from the snippet. - - - ```typescript {filename:app/app.ts} import Application from "@ember/application"; import Resolver from "ember-resolver"; @@ -97,23 +79,12 @@ export default class App extends Application { loadInitializers(App, config.modulePrefix); ``` - - - - ### Enable Performance Instrumentation - - - - To capture page loads, navigation, classic component renders, and runloop timings, create an instance initializer that calls `instrumentAppInstancePerformance()`. The `tracesSampleRate` option in `Sentry.init()` controls how much tracing data Sentry captures. The SDK skips this instrumentation during FastBoot server rendering. To customize it, see Ember Options. - - - ```typescript {filename:app/instance-initializers/sentry-performance.ts} import type ApplicationInstance from "@ember/application/instance"; import { instrumentAppInstancePerformance } from "@sentry/ember"; @@ -125,10 +96,6 @@ export function initialize(appInstance: ApplicationInstance): void { export default { initialize }; ``` - - - - ### Add Readable Stack Traces With Source Maps @@ -139,10 +106,6 @@ export default { initialize }; ## Send Logs - - - - Use `Sentry.logger` to send logs at different levels, such as `info`, `warn`, or `error`. You can pass any attributes you want and search or filter by them later. @@ -150,9 +113,6 @@ If you're already logging with `console` or [Consola](https://github.com/unjs/co See Set Up Logs for all available logging methods and the syntax for formatting messages. - - - ```javascript Sentry.logger.info("User example action completed"); @@ -167,24 +127,13 @@ Sentry.logger.error("Validation failed", { }); ``` - - - - ## Send Application Metrics - - - - Use `Sentry.metrics` to send counters, gauges, and distributions from your app to Sentry. You can pass any attributes you want and search or filter by them later. See Set Up Metrics for all available metric types and configuration options. - - - ```javascript Sentry.metrics.count("checkout.failed", 1); @@ -196,21 +145,11 @@ Sentry.metrics.distribution("api_latency", 187, { }); ``` - - - - ## Verify Your Setup Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project. - - - - Add the following test button to one of your templates, which will trigger an error when you click it: - - ```handlebars {filename: application.hbs} {{! rest of your page }} @@ -219,16 +158,8 @@ Add the following test button to one of your templates, which will trigger an er ``` - - - - - Next, add the corresponding action to your controller or component. - - - ```javascript {filename: application.js} import Controller from "@ember/controller"; import { action } from "@ember/object"; @@ -241,10 +172,6 @@ export default class ApplicationController extends Controller { } ``` - - - - ### View Captured Data in Sentry diff --git a/docs/platforms/javascript/guides/firebase/index.mdx b/docs/platforms/javascript/guides/firebase/index.mdx index 0549b511e808e..62a9a51256449 100644 --- a/docs/platforms/javascript/guides/firebase/index.mdx +++ b/docs/platforms/javascript/guides/firebase/index.mdx @@ -38,15 +38,8 @@ Choose the features you want to configure, and this guide will show you how: ### Install the Sentry SDK - - - - Run the command for your preferred package manager to add the Sentry SDK to your Firebase Functions project: - - - ```bash {tabTitle:npm} @@ -79,21 +72,10 @@ pnpm add @sentry/node @sentry/profiling-node - - - - ## Configure - - - - Create an initialization file (for example, `instrument.js`) that imports and initializes Sentry. - - - ```javascript {filename:instrument.js} const Sentry = require("@sentry/node"); // ___PRODUCT_OPTION_START___ profiling @@ -131,12 +113,6 @@ Sentry.init({ }); ``` - - - - - - Import the initialization file at the very top of your functions entry point (for example, `index.js`), before any other imports: @@ -144,8 +120,6 @@ Import the initialization file at the very top of your functions entry point (fo calls, including Firebase imports. This ensures Sentry can properly instrument all modules. - - ```javascript {filename:index.js} require("./instrument"); // Require Sentry initialization first @@ -168,10 +142,6 @@ exports.onUserCreated = onDocumentCreated("users/{userId}", async (event) => { }); ``` - - - - ### Add Readable Stack Traces With Source Maps (Optional) @@ -186,15 +156,8 @@ Let's test your setup and confirm that Sentry is working correctly and sending d ### Issues - - - - Add a test function that throws an error to verify Sentry is capturing errors: - - - ```javascript {filename:index.js} require("./instrument"); // Import Sentry initialization first const { onRequest } = require("firebase-functions/https"); @@ -204,39 +167,19 @@ exports.testSentry = onRequest(async (request, response) => { }); ``` - - - - - - Deploy your functions and trigger the test endpoint: - - - ```bash firebase deploy --only functions curl https://-.cloudfunctions.net/testSentry ``` - - - - ### Tracing - - - - Firebase Functions are automatically instrumented for tracing. You can also create custom spans: - - - ```javascript {filename:index.js} require("./instrument"); const Sentry = require("@sentry/node"); @@ -252,10 +195,6 @@ exports.tracedFunction = onRequest(async (request, response) => { }); ``` - - - - diff --git a/docs/platforms/javascript/guides/gatsby/index.mdx b/docs/platforms/javascript/guides/gatsby/index.mdx index dc90aa371da11..1e077dfe392fd 100644 --- a/docs/platforms/javascript/guides/gatsby/index.mdx +++ b/docs/platforms/javascript/guides/gatsby/index.mdx @@ -15,10 +15,6 @@ categories: ### Install the Sentry SDK - - - - Run the command for your preferred package manager to add the Sentry SDK to your application. @@ -27,9 +23,6 @@ Run the command for your preferred package manager to add the Sentry SDK to your - - - ```bash {tabTitle:npm} npm install @sentry/gatsby --save ``` @@ -42,21 +35,10 @@ yarn add @sentry/gatsby pnpm add @sentry/gatsby ``` - - - - ### Register the Sentry SDK - - - - Register `@sentry/gatsby` in your Gatsby configuration file (typically `gatsby-config.(js|ts)`). - - - ```javascript {tabTitle: CommonJS}{filename:gatsby-config.(js|ts)} module.exports = { plugins: [ @@ -82,10 +64,6 @@ const config: GatsbyConfig = { export default config; ``` - - - - ## Configure Choose the features you want to configure, and this guide will show you how: @@ -103,15 +81,8 @@ Choose the features you want to configure, and this guide will show you how: ### Initialize the Sentry SDK - - - - Initialize Sentry as early as possible in your application. For this, create a new file `sentry.config.(js|ts)` in your project root and add the following: - - - ```javascript {filename:sentry.config.(js|ts)} import * as Sentry from "@sentry/gatsby"; @@ -153,10 +124,6 @@ Sentry.init({ }); ``` - - - - ### Add Readable Stack Traces With Source Maps (Optional) @@ -175,10 +142,6 @@ Let's test your setup and confirm that Sentry is working correctly and sending d ### Issues - - - - To verify that Sentry captures errors and creates issues in your Sentry project, add the following test button to one of your pages. @@ -188,9 +151,6 @@ To verify that Sentry captures errors and creates issues in your Sentry project, - - - ```javascript {filename:index.(jsx|tsx)}