Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions skills/sentry-cocoa-sdk/references/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
| `enableFileManagerSwizzling` | `Bool` | `false` | NSFileManager swizzling (experimental; needed for iOS 18+) |
| `tracePropagationTargets` | `[String]` | `[".*"]` | Hosts/regex for outgoing distributed trace headers |
| `enableSwizzling` | `Bool` | `true` | Master switch for method swizzling (required by several auto-instrumentation features) |
| `strictTraceContinuation` | `Bool` | `false` | Only continue an incoming trace when `orgId` matches; prevents cross-org trace continuation (SDK 9.x+) |
| `orgId` | `UInt64?` | auto-parsed from DSN | Organization ID used for strict trace continuation validation; auto-parsed from the DSN host |

## Code Examples

Expand Down Expand Up @@ -365,6 +367,22 @@ SentrySDK.start { options in
>
> ⚠️ Both headers must be included in CORS allowlists and must not be blocked by proxies or firewalls.

### Strict Trace Continuation (SDK 9.x+)

Enable `strictTraceContinuation` to reject incoming traces from other Sentry organizations. When enabled, the SDK validates that the `sentry-trace` header's organization ID matches your DSN's organization before continuing the trace:

```swift
SentrySDK.start { options in
options.dsn = "___PUBLIC_DSN___"
options.tracesSampleRate = 1.0

// Only accept traces from your own Sentry organization
options.strictTraceContinuation = true
// orgId is auto-parsed from DSN host; override only if needed:
// options.orgId = 12345
}
```

---

## Platform Support Matrix
Expand Down
15 changes: 15 additions & 0 deletions skills/sentry-php-sdk/references/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,28 @@ Metrics are buffered in a ring buffer (capacity: 1000 entries):

**Buffer limit:** When more than 1000 metrics are buffered, the oldest entries are dropped. Flush periodically in high-volume scripts.

## Threshold-Based Auto-Flushing

Use `metric_flush_threshold` to automatically flush buffered metrics after N entries, without needing to call `flush()` manually:

**PHP / Laravel:**
```php
\Sentry\init([
'dsn' => '___PUBLIC_DSN___',
'metric_flush_threshold' => 100, // flush after every 100 buffered metrics
]);
```

This is useful in CLI scripts or workers that emit metrics continuously. The threshold triggers a flush mid-process so the buffer never fills to its 1000-entry cap.

## Symfony Configuration

```yaml
sentry:
options:
enable_metrics: true # default: true
attach_metric_code_locations: true # attach file/line info
metric_flush_threshold: 100 # auto-flush after N buffered metrics
before_send_metric: 'App\Sentry\BeforeSendMetricCallback'
```

Expand Down
16 changes: 16 additions & 0 deletions skills/sentry-react-native-sdk/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,21 @@ Sentry.init({
export default Sentry.wrap(App);
```

### App Start Accuracy — `Sentry.appLoaded()` (SDK ≥8.x)

If your app does significant async work after the root component mounts (e.g., fetching config, waiting for auth), call `Sentry.appLoaded()` once that work is complete. This signals the true end of app startup to Sentry and produces more accurate app start duration measurements.

```typescript
// Call after async initialization is complete, e.g., in a useEffect or after a loading screen:
useEffect(() => {
fetchConfig().then(() => {
Sentry.appLoaded(); // marks the end of the app startup phase
});
}, []);
```

If you don't call `Sentry.appLoaded()`, the SDK estimates the app start end automatically.

---

### Navigation Setup — React Navigation (v5+)
Expand Down Expand Up @@ -569,6 +584,7 @@ For each feature: `Read ${SKILL_ROOT}/references/<feature>.md`, follow steps exa
| `enableAutoPerformanceTracing` | `boolean` | `true` | Auto performance instrumentation |
| `enableNdkScopeSync` | `boolean` | `true` | Java→NDK scope sync (Android) |
| `attachThreads` | `boolean` | `false` | Auto-attach all threads on crash (Android) |
| `attachAllThreads` | `boolean` | `false` | Attach full stack traces of all threads to error events (iOS only) |
| `autoInitializeNativeSdk` | `boolean` | `true` | Set `false` for manual native init |
| `onReady` | `function` | — | Callback after native SDKs initialize |

Expand Down
18 changes: 18 additions & 0 deletions skills/sentry-react-sdk/references/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,24 @@ const router = sentryCreateBrowserRouter([
]);
```

**Simpler alternative — `sentryOnError`**

For routes where you don't need custom error UI, use the exported `Sentry.sentryOnError` as the route's `onError` handler. It captures loader, action, and component errors directly without requiring a component:

```typescript
import * as Sentry from "@sentry/react";
import { createBrowserRouter } from "react-router";

const router = Sentry.wrapCreateBrowserRouterV7(createBrowserRouter)([
{
path: "/",
element: <RootLayout />,
onError: Sentry.sentryOnError, // automatically captures route errors
children: [...],
},
Comment on lines +459 to +466
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The documentation example for React Router v7 incorrectly uses the onError property on a route object. The correct property is errorElement, causing silent failure of error reporting.
Severity: HIGH

Suggested Fix

Replace the incorrect onError: Sentry.sentryOnError example with the correct pattern using the errorElement property, such as errorElement: <SentryRouteErrorBoundary />. This will align the new example with the established, correct pattern already present in the documentation and ensure routing errors are captured by Sentry.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: skills/sentry-react-sdk/references/tracing.md#L459-L466

Potential issue: The documentation example for React Router v7 error handling suggests
using `onError: Sentry.sentryOnError` on individual route objects. However, `onError` is
not a valid property for route objects in React Router v7; it is only valid on the
`<RouterProvider>` component. The correct property is `errorElement`. This is
contradicted by another example in the same file which correctly uses `errorElement`.
Code following the new, incorrect example will silently fail to capture routing errors,
leading to a complete loss of error visibility for those routes.

Did we get this right? 👍 / 👎 to inform future reviews.

]);
```

---

### React Router v6
Expand Down
Loading