@danieljvdm/dev-kit 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +1 -1
- package/skill-sources.jsonc +2 -33
- package/skill-sources.lock.json +15 -117
- package/skills/animate/LICENSE +21 -0
- package/skills/animate/NOTICE +10 -0
- package/skills/animate/SKILL.md +34 -0
- package/skills/animate/references/gestures.md +27 -0
- package/skills/animate/references/glossary.md +136 -0
- package/skills/animate/references/implementation.md +22 -0
- package/skills/animate/references/opportunities.md +18 -0
- package/skills/animate/references/principles.md +48 -0
- package/skills/animate/references/review.md +19 -0
- package/skills/cloudflare-workers/LICENSE +202 -0
- package/skills/cloudflare-workers/NOTICE +9 -0
- package/skills/cloudflare-workers/SKILL.md +26 -0
- package/skills/cloudflare-workers/references/durable-objects.md +68 -0
- package/skills/cloudflare-workers/references/sandbox.md +48 -0
- package/skills/cloudflare-workers/references/workers.md +63 -0
- package/skills/cloudflare-workers/references/wrangler.md +56 -0
- package/skills/design-ui/LICENSE +21 -0
- package/skills/design-ui/NOTICE +8 -0
- package/skills/design-ui/SKILL.md +29 -0
- package/skills/design-ui/references/appearance.md +22 -0
- package/skills/design-ui/references/components.md +33 -0
- package/skills/design-ui/references/exploration.md +50 -0
- package/skills/design-ui/references/libraries.md +39 -0
- package/skills/design-ui/references/themes.md +23 -0
- package/skills/dev-kit/SKILL.md +19 -38
- package/skills/dev-kit/references/cloudflare-worker-api.md +1 -1
- package/skills/dev-kit/references/skills.md +2 -2
- package/skills/effect-development/SKILL.md +27 -0
- package/skills/effect-development/agents/openai.yaml +4 -0
- package/skills/effect-development/references/api/index.md +32 -0
- package/skills/effect-development/references/api/schema-codecs.md +15 -0
- package/skills/{build-effect-apis/references → effect-development/references/api}/verification.md +10 -5
- package/skills/{effect-architecture-audit/SKILL.md → effect-development/references/architecture/index.md} +1 -6
- package/skills/{effect-atom-state/references → effect-development/references/atom}/effect-atom-client.md +8 -6
- package/skills/{effect-atom-state/references → effect-development/references/atom}/effect-atom-testing.md +7 -2
- package/skills/effect-development/references/atom/index.md +40 -0
- package/skills/{build-effect-clis/references → effect-development/references/cli}/entrypoints-and-testing.md +6 -2
- package/skills/effect-development/references/cli/index.md +39 -0
- package/skills/effect-development/references/setup.md +15 -0
- package/skills/open-pull-request/SKILL.md +10 -70
- package/skills/open-pull-request/references/evidence.md +22 -0
- package/skills/open-pull-request/references/explanation.md +21 -0
- package/skills/open-pull-request/references/publication.md +21 -0
- package/skills/sentry/LICENSE +202 -0
- package/skills/sentry/LICENSE-UPSTREAM +21 -0
- package/skills/sentry/NOTICE +14 -0
- package/skills/sentry/SKILL.md +33 -0
- package/skills/sentry/references/alert-payloads.md +105 -0
- package/skills/sentry/references/alerts.md +17 -0
- package/skills/sentry/references/artifacts.md +25 -0
- package/skills/sentry/references/auth-token.md +65 -0
- package/skills/sentry/references/concepts/ai-monitoring.md +131 -0
- package/skills/sentry/references/concepts/choosing-a-signal.md +78 -0
- package/skills/sentry/references/concepts/crons.md +50 -0
- package/skills/sentry/references/concepts/data-scrubbing.md +43 -0
- package/skills/sentry/references/concepts/errors.md +40 -0
- package/skills/sentry/references/concepts/logging.md +85 -0
- package/skills/sentry/references/concepts/metrics.md +49 -0
- package/skills/sentry/references/concepts/monitors.md +78 -0
- package/skills/sentry/references/concepts/profiling.md +38 -0
- package/skills/sentry/references/concepts/reduce-volume.md +49 -0
- package/skills/sentry/references/concepts/releases.md +43 -0
- package/skills/sentry/references/concepts/session-replay.md +35 -0
- package/skills/sentry/references/concepts/tracing.md +54 -0
- package/skills/sentry/references/concepts/user-feedback.md +36 -0
- package/skills/sentry/references/debug-artifacts/android.md +68 -0
- package/skills/sentry/references/debug-artifacts/apple.md +96 -0
- package/skills/sentry/references/debug-artifacts/dotnet.md +70 -0
- package/skills/sentry/references/debug-artifacts/flutter.md +65 -0
- package/skills/sentry/references/debug-artifacts/index.md +75 -0
- package/skills/sentry/references/debug-artifacts/javascript.md +94 -0
- package/skills/sentry/references/debug-artifacts/matching.md +73 -0
- package/skills/sentry/references/debug-artifacts/react-native.md +75 -0
- package/skills/sentry/references/first-error-setup.md +25 -0
- package/skills/sentry/references/instrumentation.md +30 -0
- package/skills/sentry/references/issues.md +32 -0
- package/skills/sentry/references/new-project.md +17 -0
- package/skills/sentry/references/otel-exporter.md +30 -0
- package/skills/sentry/references/release-workflow.md +31 -0
- package/skills/sentry/references/releases/ci-pipeline.md +214 -0
- package/skills/sentry/references/releases/index.md +93 -0
- package/skills/sentry/references/releases/suspect-commits.md +155 -0
- package/skills/sentry/references/releases/tagging.md +131 -0
- package/skills/sentry/references/releases/troubleshooting.md +67 -0
- package/skills/sentry/references/sdks/android/crons.md +305 -0
- package/skills/sentry/references/sdks/android/error-monitoring.md +800 -0
- package/skills/sentry/references/sdks/android/index.md +748 -0
- package/skills/sentry/references/sdks/android/integrations.md +48 -0
- package/skills/sentry/references/sdks/android/logging.md +374 -0
- package/skills/sentry/references/sdks/android/metrics.md +288 -0
- package/skills/sentry/references/sdks/android/profiling.md +397 -0
- package/skills/sentry/references/sdks/android/session-replay.md +406 -0
- package/skills/sentry/references/sdks/android/tracing.md +861 -0
- package/skills/sentry/references/sdks/browser/error-monitoring.md +861 -0
- package/skills/sentry/references/sdks/browser/index.md +714 -0
- package/skills/sentry/references/sdks/browser/logging.md +315 -0
- package/skills/sentry/references/sdks/browser/profiling.md +236 -0
- package/skills/sentry/references/sdks/browser/session-replay.md +586 -0
- package/skills/sentry/references/sdks/browser/tracing.md +561 -0
- package/skills/sentry/references/sdks/browser/user-feedback.md +354 -0
- package/skills/sentry/references/sdks/cloudflare/ai-monitoring.md +661 -0
- package/skills/sentry/references/sdks/cloudflare/crons.md +231 -0
- package/skills/sentry/references/sdks/cloudflare/durable-objects.md +381 -0
- package/skills/sentry/references/sdks/cloudflare/error-monitoring.md +329 -0
- package/skills/sentry/references/sdks/cloudflare/index.md +698 -0
- package/skills/sentry/references/sdks/cloudflare/logging.md +169 -0
- package/skills/sentry/references/sdks/cloudflare/nodejs-compat.md +134 -0
- package/skills/sentry/references/sdks/cloudflare/tracing.md +475 -0
- package/skills/sentry/references/sdks/cocoa/error-monitoring.md +394 -0
- package/skills/sentry/references/sdks/cocoa/index.md +497 -0
- package/skills/sentry/references/sdks/cocoa/logging.md +209 -0
- package/skills/sentry/references/sdks/cocoa/metrics.md +136 -0
- package/skills/sentry/references/sdks/cocoa/profiling.md +223 -0
- package/skills/sentry/references/sdks/cocoa/session-replay.md +257 -0
- package/skills/sentry/references/sdks/cocoa/tracing.md +524 -0
- package/skills/sentry/references/sdks/cocoa/user-feedback.md +310 -0
- package/skills/sentry/references/sdks/dotnet/crons.md +465 -0
- package/skills/sentry/references/sdks/dotnet/error-monitoring.md +1100 -0
- package/skills/sentry/references/sdks/dotnet/index.md +614 -0
- package/skills/sentry/references/sdks/dotnet/logging.md +556 -0
- package/skills/sentry/references/sdks/dotnet/metrics.md +229 -0
- package/skills/sentry/references/sdks/dotnet/profiling.md +296 -0
- package/skills/sentry/references/sdks/dotnet/tracing.md +897 -0
- package/skills/sentry/references/sdks/elixir/crons.md +371 -0
- package/skills/sentry/references/sdks/elixir/error-monitoring.md +335 -0
- package/skills/sentry/references/sdks/elixir/index.md +383 -0
- package/skills/sentry/references/sdks/elixir/logging.md +239 -0
- package/skills/sentry/references/sdks/elixir/tracing.md +233 -0
- package/skills/sentry/references/sdks/flutter/ecosystem-integrations.md +70 -0
- package/skills/sentry/references/sdks/flutter/error-monitoring.md +312 -0
- package/skills/sentry/references/sdks/flutter/index.md +728 -0
- package/skills/sentry/references/sdks/flutter/logging.md +387 -0
- package/skills/sentry/references/sdks/flutter/metrics.md +310 -0
- package/skills/sentry/references/sdks/flutter/profiling.md +214 -0
- package/skills/sentry/references/sdks/flutter/session-replay.md +308 -0
- package/skills/sentry/references/sdks/flutter/tracing.md +502 -0
- package/skills/sentry/references/sdks/go/crons.md +270 -0
- package/skills/sentry/references/sdks/go/error-monitoring.md +361 -0
- package/skills/sentry/references/sdks/go/index.md +324 -0
- package/skills/sentry/references/sdks/go/logging.md +354 -0
- package/skills/sentry/references/sdks/go/metrics.md +273 -0
- package/skills/sentry/references/sdks/go/profiling.md +46 -0
- package/skills/sentry/references/sdks/go/tracing.md +366 -0
- package/skills/sentry/references/sdks/index.md +41 -0
- package/skills/sentry/references/sdks/nestjs/ai-monitoring.md +410 -0
- package/skills/sentry/references/sdks/nestjs/crons.md +268 -0
- package/skills/sentry/references/sdks/nestjs/error-monitoring.md +729 -0
- package/skills/sentry/references/sdks/nestjs/index.md +699 -0
- package/skills/sentry/references/sdks/nestjs/logging.md +174 -0
- package/skills/sentry/references/sdks/nestjs/metrics.md +243 -0
- package/skills/sentry/references/sdks/nestjs/profiling.md +127 -0
- package/skills/sentry/references/sdks/nestjs/tracing.md +762 -0
- package/skills/sentry/references/sdks/nextjs/ai-monitoring.md +494 -0
- package/skills/sentry/references/sdks/nextjs/crons.md +383 -0
- package/skills/sentry/references/sdks/nextjs/error-monitoring.md +974 -0
- package/skills/sentry/references/sdks/nextjs/index.md +491 -0
- package/skills/sentry/references/sdks/nextjs/logging.md +381 -0
- package/skills/sentry/references/sdks/nextjs/metrics.md +411 -0
- package/skills/sentry/references/sdks/nextjs/profiling.md +403 -0
- package/skills/sentry/references/sdks/nextjs/session-replay.md +462 -0
- package/skills/sentry/references/sdks/nextjs/tracing.md +628 -0
- package/skills/sentry/references/sdks/node/ai-monitoring.md +303 -0
- package/skills/sentry/references/sdks/node/crons.md +432 -0
- package/skills/sentry/references/sdks/node/error-monitoring.md +1125 -0
- package/skills/sentry/references/sdks/node/index.md +942 -0
- package/skills/sentry/references/sdks/node/logging.md +380 -0
- package/skills/sentry/references/sdks/node/metrics.md +278 -0
- package/skills/sentry/references/sdks/node/profiling.md +373 -0
- package/skills/sentry/references/sdks/node/tracing.md +878 -0
- package/skills/sentry/references/sdks/php/ai-monitoring.md +310 -0
- package/skills/sentry/references/sdks/php/crons.md +265 -0
- package/skills/sentry/references/sdks/php/error-monitoring.md +626 -0
- package/skills/sentry/references/sdks/php/index.md +362 -0
- package/skills/sentry/references/sdks/php/laravel.md +542 -0
- package/skills/sentry/references/sdks/php/logging.md +242 -0
- package/skills/sentry/references/sdks/php/metrics.md +193 -0
- package/skills/sentry/references/sdks/php/profiling.md +115 -0
- package/skills/sentry/references/sdks/php/symfony.md +552 -0
- package/skills/sentry/references/sdks/php/tracing.md +516 -0
- package/skills/sentry/references/sdks/python/ai-monitoring.md +351 -0
- package/skills/sentry/references/sdks/python/crons.md +218 -0
- package/skills/sentry/references/sdks/python/error-monitoring.md +292 -0
- package/skills/sentry/references/sdks/python/index.md +361 -0
- package/skills/sentry/references/sdks/python/logging.md +234 -0
- package/skills/sentry/references/sdks/python/metrics.md +154 -0
- package/skills/sentry/references/sdks/python/profiling.md +120 -0
- package/skills/sentry/references/sdks/python/tracing.md +364 -0
- package/skills/sentry/references/sdks/react/error-monitoring.md +1607 -0
- package/skills/sentry/references/sdks/react/index.md +492 -0
- package/skills/sentry/references/sdks/react/logging.md +364 -0
- package/skills/sentry/references/sdks/react/profiling.md +322 -0
- package/skills/sentry/references/sdks/react/react-features.md +1272 -0
- package/skills/sentry/references/sdks/react/session-replay.md +1193 -0
- package/skills/sentry/references/sdks/react/tracing.md +1415 -0
- package/skills/sentry/references/sdks/react-native/error-monitoring.md +1481 -0
- package/skills/sentry/references/sdks/react-native/expo-config-plugin.md +45 -0
- package/skills/sentry/references/sdks/react-native/index.md +1030 -0
- package/skills/sentry/references/sdks/react-native/logging.md +444 -0
- package/skills/sentry/references/sdks/react-native/profiling.md +386 -0
- package/skills/sentry/references/sdks/react-native/session-replay.md +704 -0
- package/skills/sentry/references/sdks/react-native/tracing.md +1086 -0
- package/skills/sentry/references/sdks/react-native/user-feedback.md +815 -0
- package/skills/sentry/references/sdks/react-router-framework/error-monitoring.md +127 -0
- package/skills/sentry/references/sdks/react-router-framework/index.md +411 -0
- package/skills/sentry/references/sdks/react-router-framework/logging.md +66 -0
- package/skills/sentry/references/sdks/react-router-framework/profiling.md +57 -0
- package/skills/sentry/references/sdks/react-router-framework/react-router-framework-features.md +110 -0
- package/skills/sentry/references/sdks/react-router-framework/session-replay.md +67 -0
- package/skills/sentry/references/sdks/react-router-framework/tracing.md +96 -0
- package/skills/sentry/references/sdks/react-router-framework/user-feedback.md +71 -0
- package/skills/sentry/references/sdks/ruby/crons.md +184 -0
- package/skills/sentry/references/sdks/ruby/error-monitoring.md +248 -0
- package/skills/sentry/references/sdks/ruby/index.md +297 -0
- package/skills/sentry/references/sdks/ruby/logging.md +168 -0
- package/skills/sentry/references/sdks/ruby/metrics.md +196 -0
- package/skills/sentry/references/sdks/ruby/migration.md +321 -0
- package/skills/sentry/references/sdks/ruby/profiling.md +107 -0
- package/skills/sentry/references/sdks/ruby/tracing.md +388 -0
- package/skills/sentry/references/sdks/svelte/error-monitoring.md +456 -0
- package/skills/sentry/references/sdks/svelte/index.md +467 -0
- package/skills/sentry/references/sdks/svelte/logging.md +344 -0
- package/skills/sentry/references/sdks/svelte/session-replay.md +369 -0
- package/skills/sentry/references/sdks/svelte/tracing.md +406 -0
- package/skills/sentry/references/sdks/tanstack-start/error-monitoring.md +149 -0
- package/skills/sentry/references/sdks/tanstack-start/index.md +381 -0
- package/skills/sentry/references/sdks/tanstack-start/logging.md +74 -0
- package/skills/sentry/references/sdks/tanstack-start/session-replay.md +76 -0
- package/skills/sentry/references/sdks/tanstack-start/tanstackstart-features.md +128 -0
- package/skills/sentry/references/sdks/tanstack-start/tracing.md +123 -0
- package/skills/sentry/references/sdks/tanstack-start/user-feedback.md +81 -0
- package/skills/sentry/references/search-query-language.md +226 -0
- package/skills/sentry/references/semantics/angular.md +7 -0
- package/skills/sentry/references/semantics/app.md +28 -0
- package/skills/sentry/references/semantics/art.md +17 -0
- package/skills/sentry/references/semantics/aws.md +43 -0
- package/skills/sentry/references/semantics/browser.md +34 -0
- package/skills/sentry/references/semantics/cache.md +12 -0
- package/skills/sentry/references/semantics/client.md +8 -0
- package/skills/sentry/references/semantics/cloud.md +12 -0
- package/skills/sentry/references/semantics/cloudflare.md +23 -0
- package/skills/sentry/references/semantics/code.md +11 -0
- package/skills/sentry/references/semantics/culture.md +11 -0
- package/skills/sentry/references/semantics/db.md +21 -0
- package/skills/sentry/references/semantics/device.md +43 -0
- package/skills/sentry/references/semantics/error.md +7 -0
- package/skills/sentry/references/semantics/event.md +8 -0
- package/skills/sentry/references/semantics/exception.md +10 -0
- package/skills/sentry/references/semantics/faas.md +19 -0
- package/skills/sentry/references/semantics/file.md +8 -0
- package/skills/sentry/references/semantics/flag.md +7 -0
- package/skills/sentry/references/semantics/gcp.md +16 -0
- package/skills/sentry/references/semantics/gen_ai.md +53 -0
- package/skills/sentry/references/semantics/general.md +11 -0
- package/skills/sentry/references/semantics/graphql.md +9 -0
- package/skills/sentry/references/semantics/grpc.md +19 -0
- package/skills/sentry/references/semantics/http.md +34 -0
- package/skills/sentry/references/semantics/index.md +63 -0
- package/skills/sentry/references/semantics/jsonrpc.md +8 -0
- package/skills/sentry/references/semantics/jvm.md +12 -0
- package/skills/sentry/references/semantics/koa.md +7 -0
- package/skills/sentry/references/semantics/logger.md +7 -0
- package/skills/sentry/references/semantics/mcp.md +37 -0
- package/skills/sentry/references/semantics/mdc.md +7 -0
- package/skills/sentry/references/semantics/messaging.md +23 -0
- package/skills/sentry/references/semantics/middleware.md +7 -0
- package/skills/sentry/references/semantics/navigation.md +9 -0
- package/skills/sentry/references/semantics/nel.md +11 -0
- package/skills/sentry/references/semantics/network.md +17 -0
- package/skills/sentry/references/semantics/os.md +15 -0
- package/skills/sentry/references/semantics/otel.md +10 -0
- package/skills/sentry/references/semantics/params.md +7 -0
- package/skills/sentry/references/semantics/process.md +14 -0
- package/skills/sentry/references/semantics/react.md +7 -0
- package/skills/sentry/references/semantics/remix.md +7 -0
- package/skills/sentry/references/semantics/resource.md +7 -0
- package/skills/sentry/references/semantics/rpc.md +10 -0
- package/skills/sentry/references/semantics/score.md +10 -0
- package/skills/sentry/references/semantics/sentry.md +69 -0
- package/skills/sentry/references/semantics/server.md +8 -0
- package/skills/sentry/references/semantics/service.md +8 -0
- package/skills/sentry/references/semantics/session.md +7 -0
- package/skills/sentry/references/semantics/state.md +7 -0
- package/skills/sentry/references/semantics/thread.md +8 -0
- package/skills/sentry/references/semantics/timber.md +7 -0
- package/skills/sentry/references/semantics/trpc.md +8 -0
- package/skills/sentry/references/semantics/ui.md +18 -0
- package/skills/sentry/references/semantics/url.md +15 -0
- package/skills/sentry/references/semantics/user.md +17 -0
- package/skills/sentry/references/semantics/user_agent.md +7 -0
- package/skills/sentry/references/semantics/vercel.md +42 -0
- package/skills/sentry/references/setup-verification.md +39 -0
- package/skills/sentry/references/snapshots/github-actions-fanout.md +206 -0
- package/skills/sentry/references/snapshots/github-actions-simple.md +102 -0
- package/skills/sentry/references/snapshots/github-actions-swift-snapshot-testing.md +118 -0
- package/skills/sentry/references/snapshots/index.md +19 -0
- package/skills/sentry/references/snapshots/snapshot-previews.md +100 -0
- package/skills/sentry/references/snapshots/snapshots.md +123 -0
- package/skills/sentry/references/snapshots/wizard-setup.md +134 -0
- package/skills/testing/LICENSE +21 -0
- package/skills/testing/NOTICE +7 -0
- package/skills/testing/SKILL.md +13 -19
- package/skills/testing/agents/openai.yaml +1 -2
- package/skills/testing/references/selection.md +23 -0
- package/skills/testing/references/tdd.md +19 -0
- package/skills/testing/references/test-design.md +17 -0
- package/src/catalog.ts +1 -7
- package/skills/build-effect-apis/SKILL.md +0 -81
- package/skills/build-effect-apis/agents/openai.yaml +0 -4
- package/skills/build-effect-clis/SKILL.md +0 -92
- package/skills/build-effect-clis/agents/openai.yaml +0 -4
- package/skills/effect-architecture-audit/agents/openai.yaml +0 -4
- package/skills/effect-atom-state/SKILL.md +0 -97
- package/skills/effect-atom-state/agents/openai.yaml +0 -4
- package/skills/effect-ts/SKILL.md +0 -35
- package/skills/effect-ts/agents/openai.yaml +0 -4
- /package/skills/{build-effect-apis/references → effect-development/references/api}/cloudflare-workers.md +0 -0
- /package/skills/{build-effect-apis/references → effect-development/references/api}/runtime-assembly.md +0 -0
- /package/skills/{build-effect-apis/references → effect-development/references/api}/server-and-middleware.md +0 -0
- /package/skills/{build-effect-apis/references → effect-development/references/api}/shared-contracts.md +0 -0
- /package/skills/{effect-architecture-audit/references → effect-development/references/architecture}/service-and-boundary-audit.md +0 -0
- /package/skills/{effect-atom-state/references → effect-development/references/atom}/effect-atom-lifecycle.md +0 -0
- /package/skills/{effect-atom-state/references → effect-development/references/atom}/effect-atom-workflows.md +0 -0
- /package/skills/{effect-atom-state/references → effect-development/references/atom}/tanstack-start.md +0 -0
- /package/skills/{build-effect-clis/references → effect-development/references/cli}/command-design.md +0 -0
- /package/skills/{build-effect-clis/references → effect-development/references/cli}/processes-and-platform.md +0 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
# Logging — Sentry React SDK
|
|
2
|
+
|
|
3
|
+
> Minimum SDK: `@sentry/react` ≥9.41.0+ for `Sentry.logger` API and `enableLogs`\
|
|
4
|
+
> `consoleLoggingIntegration()`: requires ≥10.13.0+\
|
|
5
|
+
> Scope-based attributes (`getGlobalScope`, `getIsolationScope`): requires ≥10.32.0+
|
|
6
|
+
|
|
7
|
+
> ⚠️ **Not available via CDN/loader snippet** — NPM install required.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Enabling Logs
|
|
12
|
+
|
|
13
|
+
`enableLogs` is opt-in and must be explicitly set in `Sentry.init()`:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import * as Sentry from "@sentry/react";
|
|
17
|
+
|
|
18
|
+
Sentry.init({
|
|
19
|
+
dsn: import.meta.env.VITE_SENTRY_DSN,
|
|
20
|
+
enableLogs: true, // Required — logging is disabled by default
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Without `enableLogs: true`, all `Sentry.logger.*` calls are silently no-ops and nothing
|
|
25
|
+
is sent to Sentry.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Logger API — Six Levels
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import * as Sentry from "@sentry/react";
|
|
33
|
+
|
|
34
|
+
Sentry.logger.trace("Entering processOrder", { fn: "processOrder", orderId: "ord_1" });
|
|
35
|
+
Sentry.logger.debug("Cache lookup", { key: "user:123", hit: false });
|
|
36
|
+
Sentry.logger.info("Order created", { orderId: "order_456", total: 99.99 });
|
|
37
|
+
Sentry.logger.warn("Rate limit approaching", { current: 95, max: 100 });
|
|
38
|
+
Sentry.logger.error("Payment failed", { reason: "card_declined", userId: "u_1" });
|
|
39
|
+
Sentry.logger.fatal("Database unavailable", { host: "db-primary" });
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Level | Method | Typical Use |
|
|
43
|
+
| ------- | ----------------------- | ----------------------------------------------------------------------------------- |
|
|
44
|
+
| `trace` | `Sentry.logger.trace()` | Ultra-granular function entry/exit; high-volume — filter aggressively in production |
|
|
45
|
+
| `debug` | `Sentry.logger.debug()` | Development diagnostics, cache hits/misses, local state changes |
|
|
46
|
+
| `info` | `Sentry.logger.info()` | Normal business milestones, confirmations |
|
|
47
|
+
| `warn` | `Sentry.logger.warn()` | Degraded state, approaching limits, recoverable issues |
|
|
48
|
+
| `error` | `Sentry.logger.error()` | Failures requiring attention |
|
|
49
|
+
| `fatal` | `Sentry.logger.fatal()` | Critical failures, system unavailable |
|
|
50
|
+
|
|
51
|
+
**Attribute value types:** `string`, `number`, `boolean` only — `undefined`, arrays, and
|
|
52
|
+
objects are not accepted.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Parameterized Messages — `Sentry.logger.fmt`
|
|
57
|
+
|
|
58
|
+
The `fmt` tagged template literal binds each interpolated variable as a **structured,
|
|
59
|
+
searchable attribute** in Sentry:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
const userId = "user_123";
|
|
63
|
+
const productName = "Widget Pro";
|
|
64
|
+
const amount = 49.99;
|
|
65
|
+
|
|
66
|
+
Sentry.logger.info(Sentry.logger.fmt`User ${userId} purchased ${productName} for $${amount}`);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This produces:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
message.template: "User %s purchased %s for $%s"
|
|
73
|
+
message.parameter.0: "user_123"
|
|
74
|
+
message.parameter.1: "Widget Pro"
|
|
75
|
+
message.parameter.2: 49.99
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Each parameter is independently searchable in Sentry’s log explorer.
|
|
79
|
+
You can filter by `message.parameter.0 = "user_123"` without matching the full message
|
|
80
|
+
string.
|
|
81
|
+
|
|
82
|
+
> ⚠️ `logger.fmt` must be used as a **tagged template literal** — not as a function
|
|
83
|
+
> call. `Sentry.logger.fmt("text")` will not produce structured parameters.
|
|
84
|
+
|
|
85
|
+
### When to use `fmt` vs plain attributes
|
|
86
|
+
|
|
87
|
+
| Approach | Use when |
|
|
88
|
+
| --------------------------------------------------------------- | ------------------------------------------------------ |
|
|
89
|
+
| `Sentry.logger.info(msg, { key: val })` | Variables are logically distinct attributes with names |
|
|
90
|
+
| `Sentry.logger.info` with a `Sentry.logger.fmt` tagged template | Variables are part of a human-readable sentence |
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Console Capture — `consoleLoggingIntegration`
|
|
95
|
+
|
|
96
|
+
Automatically forwards `console.*` calls to Sentry as structured logs.
|
|
97
|
+
Requires SDK ≥10.13.0.
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
Sentry.init({
|
|
101
|
+
dsn: import.meta.env.VITE_SENTRY_DSN,
|
|
102
|
+
enableLogs: true,
|
|
103
|
+
integrations: [
|
|
104
|
+
Sentry.consoleLoggingIntegration({
|
|
105
|
+
levels: ["log", "warn", "error"], // which console methods to forward
|
|
106
|
+
}),
|
|
107
|
+
],
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// These calls are now automatically sent to Sentry:
|
|
111
|
+
console.log("User action recorded", { userId: 123 });
|
|
112
|
+
console.warn("Slow render detected", 240, "ms");
|
|
113
|
+
console.error("Fetch failed", new Error("timeout"));
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Multiple arguments are mapped to positional parameters:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
console.log("Text", 123, true)
|
|
120
|
+
→ message.parameter.0 = 123
|
|
121
|
+
→ message.parameter.1 = true
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Capturable console levels
|
|
125
|
+
|
|
126
|
+
| Console method | Sentry log level |
|
|
127
|
+
| -------------------------- | ---------------- |
|
|
128
|
+
| `console.log` | `info` |
|
|
129
|
+
| `console.info` | `info` |
|
|
130
|
+
| `console.warn` | `warn` |
|
|
131
|
+
| `console.error` | `error` |
|
|
132
|
+
| `console.debug` | `debug` |
|
|
133
|
+
| `console.assert` (failing) | `error` |
|
|
134
|
+
|
|
135
|
+
Configure `levels` to include only the methods you want forwarded.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Log Filtering — `beforeSendLog`
|
|
140
|
+
|
|
141
|
+
Use `beforeSendLog` to drop, modify, or scrub logs before they leave the client.
|
|
142
|
+
Return `null` to discard:
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
Sentry.init({
|
|
146
|
+
dsn: import.meta.env.VITE_SENTRY_DSN,
|
|
147
|
+
enableLogs: true,
|
|
148
|
+
beforeSendLog: (log) => {
|
|
149
|
+
// Drop debug and trace logs in production
|
|
150
|
+
if (log.level === "debug" || log.level === "trace") {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Scrub sensitive attribute keys
|
|
155
|
+
if (log.attributes?.password) {
|
|
156
|
+
delete log.attributes.password;
|
|
157
|
+
}
|
|
158
|
+
if (log.attributes?.["credit_card"]) {
|
|
159
|
+
log.attributes["credit_card"] = "[REDACTED]";
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Drop noisy health-check logs by message content
|
|
163
|
+
if (log.message?.includes("/health")) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return log; // send the (possibly modified) log
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### The `log` object shape
|
|
173
|
+
|
|
174
|
+
| Field | Type | Description |
|
|
175
|
+
| ------------ | -------- | ------------------------------------------------------------------------ |
|
|
176
|
+
| `level` | `string` | `"trace"` \| `"debug"` \| `"info"` \| `"warn"` \| `"error"` \| `"fatal"` |
|
|
177
|
+
| `message` | `string` | The log message text |
|
|
178
|
+
| `timestamp` | `number` | Unix timestamp |
|
|
179
|
+
| `attributes` | `object` | Key/value pairs attached to this log |
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Structured Attributes
|
|
184
|
+
|
|
185
|
+
Every `Sentry.logger.*` call accepts an attributes object as its second argument:
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
Sentry.logger.info("Checkout completed", {
|
|
189
|
+
orderId: "ord_789",
|
|
190
|
+
userId: "usr_123",
|
|
191
|
+
cartValue: 149.99,
|
|
192
|
+
itemCount: 3,
|
|
193
|
+
paymentMethod: "stripe",
|
|
194
|
+
userTier: "premium",
|
|
195
|
+
duration: Date.now() - startTime,
|
|
196
|
+
});
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Attributes become **searchable and filterable** in Sentry’s log explorer.
|
|
200
|
+
Prefer one comprehensive log with all relevant context over many small scattered logs
|
|
201
|
+
("wide events").
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Scope-Based Automatic Attributes (SDK ≥10.32.0)
|
|
206
|
+
|
|
207
|
+
Attributes set on scopes are automatically added to all logs emitted within that scope.
|
|
208
|
+
|
|
209
|
+
### Global scope — entire session
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
// Set once at app startup — persists for the lifetime of the page
|
|
213
|
+
Sentry.getGlobalScope().setAttributes({
|
|
214
|
+
service: "react-checkout",
|
|
215
|
+
version: "2.1.0",
|
|
216
|
+
region: "us-east-1",
|
|
217
|
+
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Isolation scope — logical user session context
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
// Set after user authenticates
|
|
224
|
+
Sentry.getIsolationScope().setAttributes({
|
|
225
|
+
org_id: user.orgId,
|
|
226
|
+
user_tier: user.tier,
|
|
227
|
+
account_type: user.accountType,
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Current scope — single operation
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
Sentry.withScope((scope) => {
|
|
235
|
+
scope.setAttribute("order_id", "ord_789");
|
|
236
|
+
scope.setAttribute("payment_method", "stripe");
|
|
237
|
+
Sentry.logger.info("Processing payment", { amount: 49.99 });
|
|
238
|
+
// order_id and payment_method are included on this log only
|
|
239
|
+
});
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Constraint:** Scope attributes accept only `string`, `number`, and `boolean` values —
|
|
243
|
+
no arrays or objects.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Auto-Generated Attributes
|
|
248
|
+
|
|
249
|
+
These are added by the SDK to every log without any developer configuration:
|
|
250
|
+
|
|
251
|
+
| Attribute | Source | Notes |
|
|
252
|
+
| ------------------------------------ | -------------------------------- | ----------------------------------------------------------------------- |
|
|
253
|
+
| `sentry.environment` | `environment` in `Sentry.init()` | — |
|
|
254
|
+
| `sentry.release` | `release` in `Sentry.init()` | — |
|
|
255
|
+
| `sentry.sdk.name` | SDK internals | e.g., `"sentry.javascript.react"` |
|
|
256
|
+
| `sentry.sdk.version` | SDK internals | — |
|
|
257
|
+
| `browser.name` | User-Agent parsing | e.g., `"Chrome"` |
|
|
258
|
+
| `browser.version` | User-Agent parsing | e.g., `"121.0.0"` |
|
|
259
|
+
| `user.id`, `user.name`, `user.email` | `Sentry.setUser()` | Added when `Sentry.setUser()` is called (`userInfo` defaults to `true`) |
|
|
260
|
+
| `sentry.trace.parent_span_id` | Active tracing span | Enables log ↔ trace correlation |
|
|
261
|
+
| `sentry.replay_id` | Active Session Replay session | Enables log ↔ replay correlation |
|
|
262
|
+
| `message.template` | `logger.fmt` usage | The template string |
|
|
263
|
+
| `message.parameter.N` | `logger.fmt` usage | Each interpolated value |
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Log-to-Trace Correlation
|
|
268
|
+
|
|
269
|
+
When tracing is enabled alongside logging, logs are **automatically linked** to the
|
|
270
|
+
active span:
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
Sentry.init({
|
|
274
|
+
dsn: import.meta.env.VITE_SENTRY_DSN,
|
|
275
|
+
enableLogs: true,
|
|
276
|
+
tracesSampleRate: 1.0,
|
|
277
|
+
integrations: [Sentry.browserTracingIntegration()],
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
// Logs emitted inside a span are linked to it automatically
|
|
281
|
+
await Sentry.startSpan({ name: "checkout-flow", op: "ui.action" }, async () => {
|
|
282
|
+
Sentry.logger.info("Validating cart", { cartId: "cart_abc" });
|
|
283
|
+
await validateCart();
|
|
284
|
+
Sentry.logger.info("Initiating payment", { gateway: "stripe" });
|
|
285
|
+
await initiatePayment();
|
|
286
|
+
});
|
|
287
|
+
// Both logs above have sentry.trace.parent_span_id set to the checkout-flow span ID
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
In the Sentry UI:
|
|
291
|
+
|
|
292
|
+
- **From a log** → click the trace link to jump to the parent span and full trace
|
|
293
|
+
- **From a trace span** → click “Logs” to see all logs emitted during that span
|
|
294
|
+
- **From a replay** → logs are shown inline with the user session recording
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## React-Specific Best Practice: Wide Events
|
|
299
|
+
|
|
300
|
+
Prefer **one comprehensive log with all context** over many fragmented logs:
|
|
301
|
+
|
|
302
|
+
```typescript
|
|
303
|
+
// ✅ Preferred — one wide log with full context
|
|
304
|
+
Sentry.logger.info("Checkout completed", {
|
|
305
|
+
orderId: order.id,
|
|
306
|
+
userId: user.id,
|
|
307
|
+
cartValue: cart.total,
|
|
308
|
+
itemCount: cart.items.length,
|
|
309
|
+
paymentMethod: "stripe",
|
|
310
|
+
userTier: user.tier,
|
|
311
|
+
activeFeatureFlags: user.flags.join(","),
|
|
312
|
+
durationMs: Date.now() - startTime,
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// ❌ Avoid — fragmented logs with poor context
|
|
316
|
+
Sentry.logger.info("Order ID set", { orderId: order.id });
|
|
317
|
+
Sentry.logger.info("Cart total calculated", { cartValue: cart.total });
|
|
318
|
+
Sentry.logger.info("Checkout done");
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## When to Use Each API
|
|
324
|
+
|
|
325
|
+
| Scenario | Recommended API |
|
|
326
|
+
| --------------------------------------- | --------------------------------------------------------------- |
|
|
327
|
+
| Business event with structured data | `Sentry.logger.info(msg, { ...attrs })` |
|
|
328
|
+
| Message with embedded variables | `Sentry.logger.info` with a `Sentry.logger.fmt` tagged template |
|
|
329
|
+
| Capture an unexpected exception | `Sentry.captureException(err)` |
|
|
330
|
+
| Send an informational string event | `Sentry.captureMessage(msg, "info")` |
|
|
331
|
+
| Auto-capture existing `console.*` calls | `consoleLoggingIntegration({ levels: [...] })` |
|
|
332
|
+
|
|
333
|
+
Use `Sentry.logger.*` for **structured, searchable observability data**. Use
|
|
334
|
+
`captureException` for actual errors that need issue grouping and stack traces.
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Log Level Guide
|
|
339
|
+
|
|
340
|
+
| Level | When to use | Production volume |
|
|
341
|
+
| ------- | -------------------------------------------- | -------------------------- |
|
|
342
|
+
| `trace` | Function entry/exit, loop iterations | Filter out in production |
|
|
343
|
+
| `debug` | Variable values, code paths taken | Filter out in production |
|
|
344
|
+
| `info` | User actions, business milestones, API calls | Keep — low/medium volume |
|
|
345
|
+
| `warn` | Degraded paths, retries, near-limits | Keep — low volume |
|
|
346
|
+
| `error` | Failures that need investigation | Keep — should be rare |
|
|
347
|
+
| `fatal` | System-down, unrecoverable state | Keep — should be very rare |
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Troubleshooting
|
|
352
|
+
|
|
353
|
+
| Issue | Solution |
|
|
354
|
+
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
355
|
+
| Logs not appearing in Sentry | Verify `enableLogs: true` is in `Sentry.init()`; requires SDK ≥9.41.0 |
|
|
356
|
+
| `logger.fmt` not creating `message.parameter.*` | Use it as a tagged template literal — not as the function call `Sentry.logger.fmt("text", var)` |
|
|
357
|
+
| Logs not linked to traces | Ensure `browserTracingIntegration()` is added and `tracesSampleRate` > 0; logs must be emitted inside an active span |
|
|
358
|
+
| `consoleLoggingIntegration` not available | Upgrade to `@sentry/react` ≥10.13.0 |
|
|
359
|
+
| Scope attributes not appearing on logs | Upgrade to `@sentry/react` ≥10.32.0 for `getGlobalScope`/`getIsolationScope` APIs |
|
|
360
|
+
| Too many logs — high volume / costs | Use `beforeSendLog` to drop `trace` and `debug` levels in production |
|
|
361
|
+
| Log attributes contain `undefined` | Only `string`, `number`, `boolean` are accepted — filter undefined values before passing |
|
|
362
|
+
| `beforeSendLog` not firing | Confirm `enableLogs: true` is set; without it, no logs are sent and no hook is called |
|
|
363
|
+
| Sensitive data appearing in logs | Add filtering in `beforeSendLog`; better yet, avoid logging sensitive data at the call site |
|
|
364
|
+
| Logs appear but have no user context | Call `Sentry.setUser({ id, email })` after authentication (`userInfo` defaults to `true`) |
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# Browser Profiling — Sentry React SDK
|
|
2
|
+
|
|
3
|
+
> Minimum SDK: `@sentry/react` ≥10.27.0+ (Beta)
|
|
4
|
+
|
|
5
|
+
> ⚠️ **Beta status** — breaking changes may occur.
|
|
6
|
+
> Browser support is limited to Chromium-based browsers only.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## What Browser Profiling Captures
|
|
11
|
+
|
|
12
|
+
Sentry’s browser profiler uses the
|
|
13
|
+
[JS Self-Profiling API](https://wicg.github.io/js-self-profiling/) to capture:
|
|
14
|
+
|
|
15
|
+
- **JavaScript call stacks** — function names and source file locations (deobfuscated
|
|
16
|
+
via source maps)
|
|
17
|
+
- **CPU time per function** — how much time is spent in each function
|
|
18
|
+
- **Flame graphs** — aggregated across real user sessions, not just local dev
|
|
19
|
+
- **Linked profiles** — every profile is attached to a trace, enabling navigation from
|
|
20
|
+
span → flame graph in the Sentry UI
|
|
21
|
+
|
|
22
|
+
Sampling rate: **100Hz (10ms intervals)** — contrast with Chrome DevTools at 1000Hz
|
|
23
|
+
(1ms). Less granular, but runs unobtrusively in production.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Browser Compatibility
|
|
28
|
+
|
|
29
|
+
| Browser | Supported | Notes |
|
|
30
|
+
| ------------------- | --------- | ---------------------------------------- |
|
|
31
|
+
| Chrome / Chromium | ✅ Yes | Primary support target |
|
|
32
|
+
| Edge (Chromium) | ✅ Yes | Same engine as Chrome |
|
|
33
|
+
| Firefox | ❌ No | Does not implement JS Self-Profiling API |
|
|
34
|
+
| Safari / iOS Safari | ❌ No | Does not implement JS Self-Profiling API |
|
|
35
|
+
|
|
36
|
+
> ⚠️ **Sampling bias:** Profile data is collected **only** from Chromium users.
|
|
37
|
+
> Firefox and Safari sessions are silently not profiled.
|
|
38
|
+
> Consider this when drawing performance conclusions.
|
|
39
|
+
|
|
40
|
+
In unsupported browsers, `browserProfilingIntegration()` **silently no-ops** — no errors
|
|
41
|
+
thrown, no overhead.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Required HTTP Header
|
|
46
|
+
|
|
47
|
+
Every document response serving your React app **must** include this header or profiling
|
|
48
|
+
silently fails:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Document-Policy: js-profiling
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Without this header, the JS Self-Profiling API is blocked by the browser and no profiles
|
|
55
|
+
are collected.
|
|
56
|
+
|
|
57
|
+
### Platform-Specific Header Setup
|
|
58
|
+
|
|
59
|
+
**Vercel (`vercel.json`):**
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"headers": [
|
|
64
|
+
{
|
|
65
|
+
"source": "/(.*)",
|
|
66
|
+
"headers": [{ "key": "Document-Policy", "value": "js-profiling" }]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Netlify (`netlify.toml`):**
|
|
73
|
+
|
|
74
|
+
```toml
|
|
75
|
+
[[headers]]
|
|
76
|
+
for = "/*"
|
|
77
|
+
[headers.values]
|
|
78
|
+
Document-Policy = "js-profiling"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Netlify (`_headers` file):**
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
/*
|
|
85
|
+
Document-Policy: js-profiling
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Express / Node.js:**
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
app.use((req, res, next) => {
|
|
92
|
+
res.set("Document-Policy", "js-profiling");
|
|
93
|
+
next();
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Nginx (`nginx.conf`):**
|
|
98
|
+
|
|
99
|
+
```nginx
|
|
100
|
+
server {
|
|
101
|
+
location / {
|
|
102
|
+
add_header Document-Policy "js-profiling";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Apache (`.htaccess`):**
|
|
108
|
+
|
|
109
|
+
```apache
|
|
110
|
+
<IfModule mod_headers.c>
|
|
111
|
+
Header set Document-Policy "js-profiling"
|
|
112
|
+
</IfModule>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**AWS CloudFront (Viewer Response function):**
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
function handler(event) {
|
|
119
|
+
var response = event.response;
|
|
120
|
+
response.headers["document-policy"] = { value: "js-profiling" };
|
|
121
|
+
return response;
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**ASP.NET Core (`Program.cs`):**
|
|
126
|
+
|
|
127
|
+
```csharp
|
|
128
|
+
app.Use(async (context, next) => {
|
|
129
|
+
context.Response.OnStarting(() => {
|
|
130
|
+
context.Response.Headers.Append("Document-Policy", "js-profiling");
|
|
131
|
+
return Task.CompletedTask;
|
|
132
|
+
});
|
|
133
|
+
await next();
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
> ⚠️ **Static hosting that disallows custom headers** (some CDNs, GitHub Pages) will
|
|
138
|
+
> prevent profiling entirely.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Setup
|
|
143
|
+
|
|
144
|
+
### Install
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npm install @sentry/react --save
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### SDK Initialization — Trace Mode (recommended)
|
|
151
|
+
|
|
152
|
+
Trace mode automatically attaches profiles to all sampled spans.
|
|
153
|
+
Use this for general production coverage:
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import * as Sentry from "@sentry/react";
|
|
157
|
+
|
|
158
|
+
Sentry.init({
|
|
159
|
+
dsn: import.meta.env.VITE_SENTRY_DSN,
|
|
160
|
+
|
|
161
|
+
integrations: [
|
|
162
|
+
Sentry.browserTracingIntegration(), // Must come BEFORE browserProfilingIntegration
|
|
163
|
+
Sentry.browserProfilingIntegration(),
|
|
164
|
+
],
|
|
165
|
+
|
|
166
|
+
// Tracing — profiles are only collected when a transaction is also sampled
|
|
167
|
+
tracesSampleRate: 1.0,
|
|
168
|
+
|
|
169
|
+
// Profiling — fraction of sessions to profile
|
|
170
|
+
profileSessionSampleRate: 1.0,
|
|
171
|
+
|
|
172
|
+
// "trace" = automatically attach profiles to all active spans
|
|
173
|
+
profileLifecycle: "trace",
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### SDK Initialization — Manual Mode
|
|
178
|
+
|
|
179
|
+
Manual mode lets you profile specific user flows or code paths explicitly:
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
import * as Sentry from "@sentry/react";
|
|
183
|
+
|
|
184
|
+
Sentry.init({
|
|
185
|
+
dsn: import.meta.env.VITE_SENTRY_DSN,
|
|
186
|
+
|
|
187
|
+
integrations: [Sentry.browserTracingIntegration(), Sentry.browserProfilingIntegration()],
|
|
188
|
+
|
|
189
|
+
tracesSampleRate: 1.0,
|
|
190
|
+
profileSessionSampleRate: 1.0,
|
|
191
|
+
// Omit profileLifecycle for manual mode (default)
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// Later, wrap specific operations:
|
|
195
|
+
Sentry.uiProfiler.startProfiler();
|
|
196
|
+
// ... user flow or expensive computation ...
|
|
197
|
+
Sentry.uiProfiler.stopProfiler();
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Configuration Parameters
|
|
203
|
+
|
|
204
|
+
| Parameter | Type | Default | Description |
|
|
205
|
+
| -------------------------- | -------------------- | ------- | -------------------------------------------------------------------------------------- |
|
|
206
|
+
| `tracesSampleRate` | `number` | — | 0.0–1.0 — fraction of transactions traced; profiles only attach to traced transactions |
|
|
207
|
+
| `profileSessionSampleRate` | `number` | — | 0.0–1.0 — session-level sampling decision for profiling |
|
|
208
|
+
| `profileLifecycle` | `"trace"` | — | Set to `"trace"` for Trace mode; omit for Manual mode |
|
|
209
|
+
| `tracePropagationTargets` | `(string\|RegExp)[]` | — | URLs where distributed trace headers are injected |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## How Profiles Attach to Traces
|
|
214
|
+
|
|
215
|
+
Profiles are **not independent** from tracing — they attach to transactions:
|
|
216
|
+
|
|
217
|
+
1. `tracesSampleRate` determines whether a transaction is traced at all
|
|
218
|
+
2. `profileSessionSampleRate` determines whether the **session** opts into profiling
|
|
219
|
+
3. A profile is only collected when **both** sampling decisions are yes
|
|
220
|
+
|
|
221
|
+
**Compound sampling example:**
|
|
222
|
+
|
|
223
|
+
- `tracesSampleRate: 0.5` + `profileSessionSampleRate: 0.5` → ~25% of sessions produce
|
|
224
|
+
profiles
|
|
225
|
+
- `tracesSampleRate: 1.0` + `profileSessionSampleRate: 1.0` → 100% (development/testing
|
|
226
|
+
only)
|
|
227
|
+
|
|
228
|
+
In the Sentry UI, open a trace and click **“Profile”** to view the flame graph for that
|
|
229
|
+
transaction.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Profiling Modes Comparison
|
|
234
|
+
|
|
235
|
+
| Mode | How to trigger | Best for |
|
|
236
|
+
| --------------------------------------- | ----------------------------------------------- | -------------------------------------------- |
|
|
237
|
+
| **Trace** (`profileLifecycle: "trace"`) | Auto-attached to every sampled span | Broad production coverage |
|
|
238
|
+
| **Manual** (default) | `uiProfiler.startProfiler()` / `stopProfiler()` | Specific high-value flows (checkout, render) |
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Sentry Profiling vs Chrome DevTools
|
|
243
|
+
|
|
244
|
+
| Aspect | Sentry Browser Profiling | Chrome DevTools |
|
|
245
|
+
| ---------------- | ------------------------------ | ---------------------------- |
|
|
246
|
+
| Environment | Production (real users) | Local development only |
|
|
247
|
+
| Sampling rate | 100Hz (10ms) | 1000Hz (1ms) |
|
|
248
|
+
| Stack traces | Deobfuscated via source maps | Minified names unless local |
|
|
249
|
+
| Data scope | Aggregated across all sessions | Single local session |
|
|
250
|
+
| Browser coverage | Chromium only | Any browser with DevTools |
|
|
251
|
+
| Overhead | Low (production-safe) | Higher — not production-safe |
|
|
252
|
+
|
|
253
|
+
> ⚠️ **Chrome DevTools conflict:** When `browserProfilingIntegration` is active, Chrome
|
|
254
|
+
> DevTools profiles incorrectly show profiling overhead mixed into rendering work.
|
|
255
|
+
> Disable the integration when doing local DevTools profiling sessions.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Source Maps — Critical for Useful Profiles
|
|
260
|
+
|
|
261
|
+
Without source maps, flame graphs show **minified function names** like `e`, `t`, `r` —
|
|
262
|
+
effectively unreadable.
|
|
263
|
+
|
|
264
|
+
With source maps uploaded to Sentry, flame graphs show **original function names** and
|
|
265
|
+
file paths from your source code.
|
|
266
|
+
|
|
267
|
+
**Setup source maps with the Vite plugin** (handles both source map upload and component
|
|
268
|
+
annotation):
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
// vite.config.ts
|
|
272
|
+
import { defineConfig } from "vite";
|
|
273
|
+
import react from "@vitejs/plugin-react";
|
|
274
|
+
import { sentryVitePlugin } from "@sentry/vite-plugin";
|
|
275
|
+
|
|
276
|
+
export default defineConfig({
|
|
277
|
+
build: {
|
|
278
|
+
sourcemap: "hidden", // Generate maps but don't serve them publicly
|
|
279
|
+
},
|
|
280
|
+
plugins: [
|
|
281
|
+
react(),
|
|
282
|
+
sentryVitePlugin({
|
|
283
|
+
org: process.env.SENTRY_ORG,
|
|
284
|
+
project: process.env.SENTRY_PROJECT,
|
|
285
|
+
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
286
|
+
sourcemaps: {
|
|
287
|
+
filesToDeleteAfterUpload: ["./**/*.map"],
|
|
288
|
+
},
|
|
289
|
+
}),
|
|
290
|
+
],
|
|
291
|
+
});
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
See the main SKILL.md **Source Maps Setup** section for Webpack/CRA configuration.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Limitations
|
|
299
|
+
|
|
300
|
+
| Limitation | Detail |
|
|
301
|
+
| ---------------------------- | ------------------------------------------------------------------------------------- |
|
|
302
|
+
| **Beta status** | API is experimental; breaking changes possible between releases |
|
|
303
|
+
| **Chromium only** | No Firefox, no Safari, no iOS — data is biased |
|
|
304
|
+
| **Requires header** | `Document-Policy: js-profiling` must be served; some hosts don’t allow custom headers |
|
|
305
|
+
| **Compound sampling** | Profiles only captured when transaction is also sampled |
|
|
306
|
+
| **10ms granularity** | Very short functions (<10ms) may not appear in profiles |
|
|
307
|
+
| **Chrome DevTools conflict** | Must disable integration when doing local DevTools profiling |
|
|
308
|
+
| **Not on CDN** | `browserProfilingIntegration` is not available via the CDN loader bundle |
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Troubleshooting
|
|
313
|
+
|
|
314
|
+
| Issue | Solution |
|
|
315
|
+
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
316
|
+
| No profiles appearing in Sentry | Verify `Document-Policy: js-profiling` header is present on document responses |
|
|
317
|
+
| Profiles exist but show minified names | Source maps not uploaded — configure `sentryVitePlugin` or `sentryWebpackPlugin` |
|
|
318
|
+
| Profiling data only from some users | Expected — only Chromium users are profiled; Firefox/Safari silently no-op |
|
|
319
|
+
| Chrome DevTools shows inflated rendering times | Disable `browserProfilingIntegration` during local DevTools sessions |
|
|
320
|
+
| `profileSessionSampleRate` has no effect | Ensure `browserProfilingIntegration()` is listed after `browserTracingIntegration()` in the integrations array |
|
|
321
|
+
| Profiling on static host not working | Verify your host supports custom response headers; GitHub Pages and some CDNs do not |
|
|
322
|
+
| Profiles not linked to spans in Trace mode | Confirm `profileLifecycle: "trace"` is set and `tracesSampleRate` > 0 |
|