From e0a6754a846882d487e51e0b5b9a51140dcf0f11 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Apr 2026 08:22:02 +0000 Subject: [PATCH] fix(skill-drift): update cocoa, php, react-native, and react skills for recent SDK changes - sentry-cocoa-sdk: add strictTraceContinuation and orgId config options (getsentry/sentry-cocoa#7705) - sentry-php-sdk: add metric_flush_threshold config option for auto-flushing metrics (getsentry/sentry-php#2059) - sentry-react-native-sdk: add attachAllThreads iOS option and Sentry.appLoaded() API (getsentry/sentry-react-native#5960, #5940) - sentry-react-sdk: export sentryOnError for react-router v7 onError handler (getsentry/sentry-javascript#20120) Co-Authored-By: Claude Sonnet 4.6 --- skills/sentry-cocoa-sdk/references/tracing.md | 18 ++++++++++++++++++ skills/sentry-php-sdk/references/metrics.md | 15 +++++++++++++++ skills/sentry-react-native-sdk/SKILL.md | 16 ++++++++++++++++ skills/sentry-react-sdk/references/tracing.md | 18 ++++++++++++++++++ 4 files changed, 67 insertions(+) diff --git a/skills/sentry-cocoa-sdk/references/tracing.md b/skills/sentry-cocoa-sdk/references/tracing.md index 502bfd5..6fa0782 100644 --- a/skills/sentry-cocoa-sdk/references/tracing.md +++ b/skills/sentry-cocoa-sdk/references/tracing.md @@ -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 @@ -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 diff --git a/skills/sentry-php-sdk/references/metrics.md b/skills/sentry-php-sdk/references/metrics.md index f96ade9..d46f847 100644 --- a/skills/sentry-php-sdk/references/metrics.md +++ b/skills/sentry-php-sdk/references/metrics.md @@ -116,6 +116,20 @@ 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 @@ -123,6 +137,7 @@ 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' ``` diff --git a/skills/sentry-react-native-sdk/SKILL.md b/skills/sentry-react-native-sdk/SKILL.md index 9eedbb9..4cc7a00 100644 --- a/skills/sentry-react-native-sdk/SKILL.md +++ b/skills/sentry-react-native-sdk/SKILL.md @@ -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+) @@ -569,6 +584,7 @@ For each feature: `Read ${SKILL_ROOT}/references/.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 | diff --git a/skills/sentry-react-sdk/references/tracing.md b/skills/sentry-react-sdk/references/tracing.md index 7d61295..e27fb81 100644 --- a/skills/sentry-react-sdk/references/tracing.md +++ b/skills/sentry-react-sdk/references/tracing.md @@ -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: , + onError: Sentry.sentryOnError, // automatically captures route errors + children: [...], + }, +]); +``` + --- ### React Router v6