@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,292 @@
|
|
|
1
|
+
# Error Monitoring — Sentry Python SDK
|
|
2
|
+
|
|
3
|
+
> Minimum SDK: `sentry-sdk` 1.x+ (2.x for `new_scope()`, `get_isolation_scope()`)
|
|
4
|
+
|
|
5
|
+
## Configuration
|
|
6
|
+
|
|
7
|
+
Key `sentry_sdk.init()` options for error monitoring:
|
|
8
|
+
|
|
9
|
+
| Option | Type | Default | Purpose |
|
|
10
|
+
| ------------------------- | --------------- | -------------------- | ----------------------------------------------- |
|
|
11
|
+
| `dsn` | `str` | env `SENTRY_DSN` | Data Source Name; SDK disabled if empty |
|
|
12
|
+
| `environment` | `str` | `"production"` | Deployment environment tag |
|
|
13
|
+
| `release` | `str` | env `SENTRY_RELEASE` | App version string |
|
|
14
|
+
| `sample_rate` | `float` | `1.0` | Fraction of error events to send (0.0–1.0) |
|
|
15
|
+
| `send_default_pii` | `bool` | `False` | Include IPs, cookies, sessions |
|
|
16
|
+
| `attach_stacktrace` | `bool` | `False` | Add stack traces to `capture_message()` |
|
|
17
|
+
| `max_breadcrumbs` | `int` | `100` | Max breadcrumbs per event |
|
|
18
|
+
| `ignore_errors` | `list` | `[]` | Exception types to never report |
|
|
19
|
+
| `before_send` | `callable` | `None` | Mutate or drop error events before sending |
|
|
20
|
+
| `before_breadcrumb` | `callable` | `None` | Mutate or drop breadcrumbs |
|
|
21
|
+
| `event_scrubber` | `EventScrubber` | `None` | Denylist-based PII scrubber |
|
|
22
|
+
| `include_local_variables` | `bool` | `True` | Capture stack-frame local variable values |
|
|
23
|
+
| `max_request_body_size` | `str` | `"medium"` | `"never"` / `"small"` / `"medium"` / `"always"` |
|
|
24
|
+
|
|
25
|
+
## Code Examples
|
|
26
|
+
|
|
27
|
+
### Basic setup
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
import sentry_sdk
|
|
31
|
+
|
|
32
|
+
sentry_sdk.init(
|
|
33
|
+
dsn="https://<key>@<org>.ingest.sentry.io/<project>",
|
|
34
|
+
environment="production",
|
|
35
|
+
release="my-app@1.0.0",
|
|
36
|
+
sample_rate=1.0,
|
|
37
|
+
send_default_pii=False,
|
|
38
|
+
max_breadcrumbs=100,
|
|
39
|
+
)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Capturing exceptions and messages
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import sentry_sdk
|
|
46
|
+
|
|
47
|
+
# Capture current exception (inside except block — reads sys.exc_info())
|
|
48
|
+
try:
|
|
49
|
+
risky_operation()
|
|
50
|
+
except Exception:
|
|
51
|
+
sentry_sdk.capture_exception()
|
|
52
|
+
|
|
53
|
+
# Capture explicit exception object
|
|
54
|
+
try:
|
|
55
|
+
risky_operation()
|
|
56
|
+
except Exception as e:
|
|
57
|
+
sentry_sdk.capture_exception(e)
|
|
58
|
+
raise # re-raise after capturing
|
|
59
|
+
|
|
60
|
+
# Capture a plain message
|
|
61
|
+
sentry_sdk.capture_message("Payment webhook received unexpected payload")
|
|
62
|
+
sentry_sdk.capture_message("Rate limit approaching", level="warning")
|
|
63
|
+
|
|
64
|
+
# Capture a fully manual event
|
|
65
|
+
sentry_sdk.capture_event({
|
|
66
|
+
"message": "Billing failure",
|
|
67
|
+
"level": "error",
|
|
68
|
+
"tags": {"payment.method": "stripe"},
|
|
69
|
+
"fingerprint": ["billing-charge-failure"],
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Automatic capture by framework
|
|
74
|
+
|
|
75
|
+
Framework integrations are **auto-enabled** when installed — no `integrations=[...]`
|
|
76
|
+
needed for most:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
# Django — unhandled view exceptions auto-captured
|
|
80
|
+
import sentry_sdk
|
|
81
|
+
sentry_sdk.init(dsn="...") # DjangoIntegration auto-enabled
|
|
82
|
+
|
|
83
|
+
# Flask — unhandled route exceptions auto-captured
|
|
84
|
+
from flask import Flask
|
|
85
|
+
import sentry_sdk
|
|
86
|
+
sentry_sdk.init(dsn="...") # FlaskIntegration auto-enabled
|
|
87
|
+
app = Flask(__name__)
|
|
88
|
+
|
|
89
|
+
# FastAPI — unhandled endpoint exceptions auto-captured
|
|
90
|
+
import sentry_sdk
|
|
91
|
+
sentry_sdk.init(dsn="...") # StarletteIntegration + FastApiIntegration auto-enabled
|
|
92
|
+
|
|
93
|
+
# Celery — task exceptions auto-captured
|
|
94
|
+
import sentry_sdk
|
|
95
|
+
sentry_sdk.init(dsn="...") # CeleryIntegration auto-enabled
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Scope management (SDK 2.x)
|
|
99
|
+
|
|
100
|
+
Three scope layers merge when sending events:
|
|
101
|
+
|
|
102
|
+
| Scope | Lifetime | Use for |
|
|
103
|
+
| ------------- | ------------------ | ------------------------------ |
|
|
104
|
+
| **Global** | Process lifetime | App-wide tags, server metadata |
|
|
105
|
+
| **Isolation** | One request / task | Per-request user, tags |
|
|
106
|
+
| **Current** | One span | Per-span metadata |
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
import sentry_sdk
|
|
110
|
+
|
|
111
|
+
# Per-request user (isolation scope — fresh per HTTP request with web integrations)
|
|
112
|
+
scope = sentry_sdk.get_isolation_scope()
|
|
113
|
+
scope.set_user({"id": "user_42", "email": "alice@example.com"})
|
|
114
|
+
scope.set_tag("request.id", "req_abc123")
|
|
115
|
+
|
|
116
|
+
# Temporary forked scope — changes don't leak out
|
|
117
|
+
with sentry_sdk.new_scope() as scope:
|
|
118
|
+
scope.set_tag("payment.retry_attempt", "3")
|
|
119
|
+
scope.set_context("charge", {"amount": 9900, "currency": "USD"})
|
|
120
|
+
scope.fingerprint = ["payment-processing-error"]
|
|
121
|
+
sentry_sdk.capture_exception(some_error)
|
|
122
|
+
# ← scope reverts here
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Context enrichment
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
import sentry_sdk
|
|
129
|
+
|
|
130
|
+
# Tags — indexed and searchable; max key 32 chars, value 200 chars
|
|
131
|
+
sentry_sdk.set_tag("page.locale", "de-at")
|
|
132
|
+
sentry_sdk.set_tags({"feature.flag": "new_checkout_v2", "plan": "enterprise"})
|
|
133
|
+
|
|
134
|
+
# User identity
|
|
135
|
+
sentry_sdk.set_user({
|
|
136
|
+
"id": "user_42",
|
|
137
|
+
"username": "alice_wonder",
|
|
138
|
+
"email": "alice@example.com",
|
|
139
|
+
"ip_address": "{{auto}}", # Sentry infers from connection
|
|
140
|
+
})
|
|
141
|
+
sentry_sdk.set_user(None) # clear user (e.g., on logout)
|
|
142
|
+
|
|
143
|
+
# Structured context objects (not searchable, visible in event detail)
|
|
144
|
+
sentry_sdk.set_context("payment", {
|
|
145
|
+
"provider": "stripe",
|
|
146
|
+
"amount": 9900,
|
|
147
|
+
"currency": "USD",
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
# Breadcrumbs
|
|
151
|
+
sentry_sdk.add_breadcrumb(
|
|
152
|
+
type="http",
|
|
153
|
+
category="auth",
|
|
154
|
+
message="User authenticated via OAuth2",
|
|
155
|
+
level="info",
|
|
156
|
+
data={"provider": "google"},
|
|
157
|
+
)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### `before_send` hook — filtering and scrubbing
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
import sentry_sdk
|
|
164
|
+
|
|
165
|
+
def before_send(event, hint):
|
|
166
|
+
exc_info = hint.get("exc_info")
|
|
167
|
+
|
|
168
|
+
# Drop non-actionable exceptions
|
|
169
|
+
if exc_info and issubclass(exc_info[0], (KeyboardInterrupt, SystemExit)):
|
|
170
|
+
return None
|
|
171
|
+
|
|
172
|
+
# Scrub sensitive HTTP headers
|
|
173
|
+
headers = event.get("request", {}).get("headers", {})
|
|
174
|
+
for h in ("Authorization", "Cookie", "X-Api-Key"):
|
|
175
|
+
if h in headers:
|
|
176
|
+
headers[h] = "[Filtered]"
|
|
177
|
+
|
|
178
|
+
# Scrub local variables
|
|
179
|
+
for exc in event.get("exception", {}).get("values", []):
|
|
180
|
+
for frame in exc.get("stacktrace", {}).get("frames", []):
|
|
181
|
+
for key in ("password", "token", "secret"):
|
|
182
|
+
frame.get("vars", {}).pop(key, None)
|
|
183
|
+
|
|
184
|
+
# Custom fingerprinting
|
|
185
|
+
if exc_info and isinstance(exc_info[1], TimeoutError):
|
|
186
|
+
event["fingerprint"] = ["network-timeout"]
|
|
187
|
+
|
|
188
|
+
return event
|
|
189
|
+
|
|
190
|
+
sentry_sdk.init(dsn="...", before_send=before_send)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Fingerprinting (custom grouping)
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
import sentry_sdk
|
|
197
|
+
|
|
198
|
+
# Static fingerprint via scope
|
|
199
|
+
with sentry_sdk.new_scope() as scope:
|
|
200
|
+
scope.fingerprint = ["database-connection-failure"]
|
|
201
|
+
sentry_sdk.capture_exception(db_error)
|
|
202
|
+
|
|
203
|
+
# Extend default grouping
|
|
204
|
+
with sentry_sdk.new_scope() as scope:
|
|
205
|
+
scope.fingerprint = ["{{ default }}", "stripe-payment-failure"]
|
|
206
|
+
sentry_sdk.capture_exception(payment_error)
|
|
207
|
+
|
|
208
|
+
# Dynamic fingerprint in before_send
|
|
209
|
+
def before_send(event, hint):
|
|
210
|
+
exc_info = hint.get("exc_info")
|
|
211
|
+
if exc_info and hasattr(exc_info[1], "status_code"):
|
|
212
|
+
code = exc_info[1].status_code
|
|
213
|
+
if code >= 500:
|
|
214
|
+
event["fingerprint"] = ["http-server-error", str(code)]
|
|
215
|
+
return event
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### PII scrubbing with EventScrubber
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
import sentry_sdk
|
|
222
|
+
from sentry_sdk.scrubber import EventScrubber, DEFAULT_DENYLIST
|
|
223
|
+
|
|
224
|
+
sentry_sdk.init(
|
|
225
|
+
dsn="...",
|
|
226
|
+
send_default_pii=False,
|
|
227
|
+
event_scrubber=EventScrubber(
|
|
228
|
+
denylist=DEFAULT_DENYLIST + ["stripe_key", "internal_secret", "ssn"],
|
|
229
|
+
recursive=True, # deep-scan nested dicts (has performance cost)
|
|
230
|
+
),
|
|
231
|
+
)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Exception Groups (Python 3.11+)
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
import sentry_sdk
|
|
238
|
+
|
|
239
|
+
# ExceptionGroup sub-exceptions appear as linked entries in Sentry UI
|
|
240
|
+
try:
|
|
241
|
+
raise ExceptionGroup(
|
|
242
|
+
"Batch job failures",
|
|
243
|
+
[ValueError("Bad record #1"), KeyError("Missing field in record #5")],
|
|
244
|
+
)
|
|
245
|
+
except* ValueError as eg:
|
|
246
|
+
sentry_sdk.capture_exception(eg)
|
|
247
|
+
except* KeyError as eg:
|
|
248
|
+
sentry_sdk.capture_exception(eg)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Advanced: Framework middleware pattern
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
import sentry_sdk
|
|
255
|
+
from flask import Flask
|
|
256
|
+
|
|
257
|
+
app = Flask(__name__)
|
|
258
|
+
sentry_sdk.init(dsn="...")
|
|
259
|
+
|
|
260
|
+
@app.before_request
|
|
261
|
+
def set_sentry_user():
|
|
262
|
+
scope = sentry_sdk.get_isolation_scope()
|
|
263
|
+
user = get_current_user()
|
|
264
|
+
if user:
|
|
265
|
+
scope.set_user({"id": str(user.id), "username": user.username})
|
|
266
|
+
scope.set_tag("user.plan", user.plan)
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Best Practices
|
|
270
|
+
|
|
271
|
+
- Set `send_default_pii=False` (default) — add explicit PII scrubbing via `before_send`
|
|
272
|
+
or `EventScrubber`
|
|
273
|
+
- Use `get_isolation_scope()` for per-request data; use `new_scope()` for temporary
|
|
274
|
+
isolated context
|
|
275
|
+
- Avoid `set_extra()` (deprecated) — use `set_context()` for structured data
|
|
276
|
+
- Prefer `set_tag()` for data you want to filter on; `set_context()` for detail-only
|
|
277
|
+
data
|
|
278
|
+
- Use `ignore_errors=[...]` for exceptions you never want reported (e.g.,
|
|
279
|
+
`KeyboardInterrupt`)
|
|
280
|
+
- Set `in_app_include=["my_package"]` to correctly mark your frames as in-app in
|
|
281
|
+
tracebacks
|
|
282
|
+
|
|
283
|
+
## Troubleshooting
|
|
284
|
+
|
|
285
|
+
| Issue | Solution |
|
|
286
|
+
| ------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
|
287
|
+
| Events not appearing in Sentry | Verify DSN, check `debug=True` output, ensure `sentry_sdk.init()` is called before app startup |
|
|
288
|
+
| User/tag data missing from events | Set scope data before the exception occurs; check isolation vs current scope |
|
|
289
|
+
| PII appearing in events | Set `send_default_pii=False` and add `EventScrubber` with your denylist |
|
|
290
|
+
| `capture_exception()` is a no-op | Must be called inside an `except` block or pass the exception explicitly |
|
|
291
|
+
| Breadcrumbs missing | Check `max_breadcrumbs` setting and `before_breadcrumb` hook |
|
|
292
|
+
| `push_scope()` / `configure_scope()` errors | Migrate to `new_scope()` / `get_isolation_scope()` (SDK 2.x) |
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
# Sentry Python SDK
|
|
2
|
+
|
|
3
|
+
Opinionated wizard that scans your Python project and guides you through complete Sentry
|
|
4
|
+
setup.
|
|
5
|
+
|
|
6
|
+
> **Note:** SDK versions and APIs below reflect Sentry docs at time of writing
|
|
7
|
+
> (sentry-sdk 2.x). Always verify against
|
|
8
|
+
> [docs.sentry.io/platforms/python/](https://docs.sentry.io/platforms/python/) before
|
|
9
|
+
> implementing.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Phase 1: Detect
|
|
14
|
+
|
|
15
|
+
Run these commands to understand the project before making recommendations:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Check existing Sentry
|
|
19
|
+
grep -i sentry requirements.txt pyproject.toml setup.cfg setup.py 2>/dev/null
|
|
20
|
+
|
|
21
|
+
# Detect web framework
|
|
22
|
+
grep -rE "django|flask|fastapi|starlette|aiohttp|tornado|quart|falcon|sanic|bottle|pyramid" \
|
|
23
|
+
requirements.txt pyproject.toml 2>/dev/null
|
|
24
|
+
|
|
25
|
+
# Detect task queues
|
|
26
|
+
grep -rE "celery|rq|huey|arq|dramatiq" requirements.txt pyproject.toml 2>/dev/null
|
|
27
|
+
|
|
28
|
+
# Detect logging libraries
|
|
29
|
+
grep -E "loguru" requirements.txt pyproject.toml 2>/dev/null
|
|
30
|
+
|
|
31
|
+
# Detect AI libraries
|
|
32
|
+
grep -rE "openai|anthropic|langchain|huggingface|google-genai|pydantic-ai|litellm" \
|
|
33
|
+
requirements.txt pyproject.toml 2>/dev/null
|
|
34
|
+
|
|
35
|
+
# Detect schedulers / crons
|
|
36
|
+
grep -rE "celery|apscheduler|schedule|crontab" requirements.txt pyproject.toml 2>/dev/null
|
|
37
|
+
|
|
38
|
+
# OpenTelemetry tracing — check for SDK + instrumentations
|
|
39
|
+
grep -rE "opentelemetry-sdk|opentelemetry-instrumentation|opentelemetry-distro" \
|
|
40
|
+
requirements.txt pyproject.toml 2>/dev/null
|
|
41
|
+
grep -rn "TracerProvider\|trace\.get_tracer\|start_as_current_span" \
|
|
42
|
+
--include="*.py" 2>/dev/null | head -5
|
|
43
|
+
|
|
44
|
+
# Check for companion frontend
|
|
45
|
+
ls frontend/ web/ client/ ui/ static/ templates/ 2>/dev/null
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**What to note:**
|
|
49
|
+
|
|
50
|
+
- Is `sentry-sdk` already in requirements?
|
|
51
|
+
If yes, check if `sentry_sdk.init()` is present — may just need feature config.
|
|
52
|
+
- Which framework? (Determines where to place `sentry_sdk.init()`.)
|
|
53
|
+
- Which task queue? (Celery needs dual-process init; RQ needs a settings file.)
|
|
54
|
+
- AI libraries? (OpenAI, Anthropic, LangChain are auto-instrumented.)
|
|
55
|
+
- OpenTelemetry tracing?
|
|
56
|
+
(Use OTLP path instead of native tracing.)
|
|
57
|
+
- Companion frontend? (Triggers Phase 4 cross-link.)
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Phase 2: Recommend
|
|
62
|
+
|
|
63
|
+
Based on what you found, present a concrete proposal.
|
|
64
|
+
Don’t ask open-ended questions — lead with a recommendation:
|
|
65
|
+
|
|
66
|
+
**Route from OTel detection:**
|
|
67
|
+
|
|
68
|
+
- **OTel tracing detected** (`opentelemetry-sdk` / `opentelemetry-distro` in
|
|
69
|
+
requirements, or `TracerProvider` in source) → use OTLP path: `OTLPIntegration()`; do
|
|
70
|
+
**not** set `traces_sample_rate`; Sentry links errors to OTel traces automatically
|
|
71
|
+
|
|
72
|
+
**Always recommended (core coverage):**
|
|
73
|
+
|
|
74
|
+
- ✅ **Error Monitoring** — captures unhandled exceptions, supports `ExceptionGroup`
|
|
75
|
+
(Python 3.11+)
|
|
76
|
+
- ✅ **Logging** — Python `logging` stdlib auto-captured; enhanced if Loguru detected
|
|
77
|
+
|
|
78
|
+
**Recommend when detected:**
|
|
79
|
+
|
|
80
|
+
- ✅ **Tracing** — HTTP framework detected (Django/Flask/FastAPI/etc.)
|
|
81
|
+
- ✅ **AI Monitoring** — OpenAI/Anthropic/LangChain/etc.
|
|
82
|
+
detected (auto-instrumented, zero config)
|
|
83
|
+
- ⚡ **Profiling** — production apps where performance matters; **not available with OTLP
|
|
84
|
+
path**
|
|
85
|
+
- ⚡ **Crons** — Celery Beat, APScheduler, or cron patterns detected
|
|
86
|
+
- ⚡ **Metrics** — business KPIs, SLO tracking
|
|
87
|
+
|
|
88
|
+
**Recommendation matrix:**
|
|
89
|
+
|
|
90
|
+
| Feature | Recommend when … | Reference |
|
|
91
|
+
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
|
|
92
|
+
| Error Monitoring | **Always** — non-negotiable baseline | `./error-monitoring.md` |
|
|
93
|
+
| OTLP Integration | OTel tracing detected — **replaces** native Tracing | `./tracing.md` |
|
|
94
|
+
| Tracing | Django/Flask/FastAPI/AIOHTTP/etc. detected; **skip if OTel tracing detected** | `./tracing.md` |
|
|
95
|
+
| Profiling | Production + performance-sensitive workload; **skip if OTel tracing detected** (requires `traces_sample_rate`, incompatible with OTLP) | `./profiling.md` |
|
|
96
|
+
| Logging | Always (stdlib); enhanced for Loguru | `./logging.md` |
|
|
97
|
+
| Metrics | Business events or SLO tracking needed | `./metrics.md` |
|
|
98
|
+
| Crons | Celery Beat, APScheduler, or cron patterns | `./crons.md` |
|
|
99
|
+
| AI Monitoring | OpenAI/Anthropic/LangChain/etc. detected | `./ai-monitoring.md` |
|
|
100
|
+
|
|
101
|
+
**OTel tracing detected:** _“I see OpenTelemetry tracing in the project.
|
|
102
|
+
I recommend Sentry’s OTLP integration for tracing (via your existing OTel setup) + Error
|
|
103
|
+
Monitoring + Sentry Logging [+ Metrics/Crons/AI Monitoring if applicable]. Shall I
|
|
104
|
+
proceed?”_
|
|
105
|
+
|
|
106
|
+
**No OTel:** _“I recommend Error Monitoring + Tracing [+ Logging if applicable]. Want
|
|
107
|
+
Profiling, Crons, or AI Monitoring too?”_
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Phase 3: Guide
|
|
112
|
+
|
|
113
|
+
### Install
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Core SDK (always required)
|
|
117
|
+
pip install sentry-sdk
|
|
118
|
+
|
|
119
|
+
# Optional extras (install only what matches detected framework):
|
|
120
|
+
pip install "sentry-sdk[django]"
|
|
121
|
+
pip install "sentry-sdk[flask]"
|
|
122
|
+
pip install "sentry-sdk[fastapi]"
|
|
123
|
+
pip install "sentry-sdk[celery]"
|
|
124
|
+
pip install "sentry-sdk[aiohttp]"
|
|
125
|
+
pip install "sentry-sdk[tornado]"
|
|
126
|
+
|
|
127
|
+
# Multiple extras:
|
|
128
|
+
pip install "sentry-sdk[django,celery]"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
> Extras are optional — plain `sentry-sdk` works for all frameworks.
|
|
132
|
+
> Extras install complementary packages.
|
|
133
|
+
|
|
134
|
+
### Quick Start — Recommended Init
|
|
135
|
+
|
|
136
|
+
Full init enabling the most features with sensible defaults.
|
|
137
|
+
Place **before** any app/framework code:
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
import os
|
|
141
|
+
import sentry_sdk
|
|
142
|
+
|
|
143
|
+
sentry_sdk.init(
|
|
144
|
+
dsn=os.environ["SENTRY_DSN"],
|
|
145
|
+
environment=os.environ.get("SENTRY_ENVIRONMENT", "production"),
|
|
146
|
+
release=os.environ.get("SENTRY_RELEASE"), # e.g. "myapp@1.0.0"
|
|
147
|
+
send_default_pii=True,
|
|
148
|
+
|
|
149
|
+
# Tracing (lower to 0.1–0.2 in high-traffic production)
|
|
150
|
+
traces_sample_rate=1.0,
|
|
151
|
+
|
|
152
|
+
# Profiling — continuous, tied to active spans
|
|
153
|
+
profile_session_sample_rate=1.0,
|
|
154
|
+
profile_lifecycle="trace",
|
|
155
|
+
|
|
156
|
+
# Structured logs (SDK ≥ 2.35.0)
|
|
157
|
+
enable_logs=True,
|
|
158
|
+
)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Where to Initialize Per Framework
|
|
162
|
+
|
|
163
|
+
| Framework | Where to call `sentry_sdk.init()` | Notes |
|
|
164
|
+
| ------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
165
|
+
| **Django** | Top of `settings.py`, before other application imports | No middleware needed — Sentry patches Django internally |
|
|
166
|
+
| **Flask** | Before `app = Flask(__name__)` | Must precede app creation |
|
|
167
|
+
| **FastAPI** | Before `app = FastAPI()` | `StarletteIntegration` + `FastApiIntegration` auto-enabled together |
|
|
168
|
+
| **Starlette** | Before `app = Starlette(...)` | Same auto-integration as FastAPI |
|
|
169
|
+
| **AIOHTTP** | Module level, before `web.Application()` | |
|
|
170
|
+
| **Tornado** | Module level, before app setup | No integration class needed |
|
|
171
|
+
| **Quart** | Before `app = Quart(__name__)` | |
|
|
172
|
+
| **Falcon** | Module level, before `app = falcon.App()` | |
|
|
173
|
+
| **Pyramid** | Module level, before `config = Configurator()` | WSGI framework |
|
|
174
|
+
| **Sanic** | Inside `@app.listener("before_server_start")` | Sanic’s lifecycle requires async init |
|
|
175
|
+
| **Celery** | `@signals.celeryd_init.connect` in worker AND in calling process | Dual-process init required |
|
|
176
|
+
| **RQ** | `mysettings.py` loaded by worker via `rq worker -c mysettings` | |
|
|
177
|
+
| **ARQ** | Both worker module and enqueuing process | |
|
|
178
|
+
|
|
179
|
+
**Django example** (`settings.py`):
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
import os
|
|
183
|
+
import sentry_sdk
|
|
184
|
+
|
|
185
|
+
sentry_sdk.init(
|
|
186
|
+
dsn=os.environ["SENTRY_DSN"],
|
|
187
|
+
send_default_pii=True,
|
|
188
|
+
traces_sample_rate=1.0,
|
|
189
|
+
profile_session_sample_rate=1.0,
|
|
190
|
+
profile_lifecycle="trace",
|
|
191
|
+
enable_logs=True,
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
# rest of Django settings...
|
|
195
|
+
INSTALLED_APPS = [...]
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**FastAPI example** (`main.py`):
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
import os
|
|
202
|
+
import sentry_sdk
|
|
203
|
+
|
|
204
|
+
sentry_sdk.init(
|
|
205
|
+
dsn=os.environ["SENTRY_DSN"],
|
|
206
|
+
send_default_pii=True,
|
|
207
|
+
traces_sample_rate=1.0,
|
|
208
|
+
profile_session_sample_rate=1.0,
|
|
209
|
+
profile_lifecycle="trace",
|
|
210
|
+
enable_logs=True,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
from fastapi import FastAPI
|
|
214
|
+
app = FastAPI()
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Auto-Enabled vs Explicit Integrations
|
|
218
|
+
|
|
219
|
+
Most integrations activate automatically when their package is installed — no
|
|
220
|
+
`integrations=[...]` needed:
|
|
221
|
+
|
|
222
|
+
| Auto-enabled | Explicit required |
|
|
223
|
+
| ------------------------------------------------------------------------------------------ | --------------------------------------------------- |
|
|
224
|
+
| Django, Flask, FastAPI, Starlette, AIOHTTP, Tornado, Quart, Falcon, Pyramid, Sanic, Bottle | `DramatiqIntegration` |
|
|
225
|
+
| Celery, RQ, Huey, ARQ | `GRPCIntegration` |
|
|
226
|
+
| SQLAlchemy, Redis, asyncpg, pymongo | `StrawberryIntegration` |
|
|
227
|
+
| Requests, HTTPX, httpx2, aiohttp-client | `AsyncioIntegration` |
|
|
228
|
+
| OpenAI, Anthropic, LangChain, Pydantic AI, MCP | `OpenAIIntegration` / `AnthropicIntegration` / etc. |
|
|
229
|
+
| Python `logging`, Loguru | — |
|
|
230
|
+
|
|
231
|
+
### For Each Agreed Feature
|
|
232
|
+
|
|
233
|
+
Walk through features one at a time.
|
|
234
|
+
Load the reference, follow its steps, verify before moving on:
|
|
235
|
+
|
|
236
|
+
| Feature | Reference file | Load when … |
|
|
237
|
+
| ---------------- | ----------------------- | ----------------------------------- |
|
|
238
|
+
| Error Monitoring | `./error-monitoring.md` | Always (baseline) |
|
|
239
|
+
| Tracing | `./tracing.md` | HTTP handlers / distributed tracing |
|
|
240
|
+
| Profiling | `./profiling.md` | Performance-sensitive production |
|
|
241
|
+
| Logging | `./logging.md` | Always; enhanced for Loguru |
|
|
242
|
+
| Metrics | `./metrics.md` | Business KPIs / SLO tracking |
|
|
243
|
+
| Crons | `./crons.md` | Scheduler / cron patterns detected |
|
|
244
|
+
| AI Monitoring | `./ai-monitoring.md` | AI library detected |
|
|
245
|
+
|
|
246
|
+
For each feature: `Read ./<feature>.md`, follow steps exactly, verify it works.
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Configuration Reference
|
|
251
|
+
|
|
252
|
+
### Key `sentry_sdk.init()` Options
|
|
253
|
+
|
|
254
|
+
| Option | Type | Default | Purpose |
|
|
255
|
+
| ----------------------------- | ---------- | -------------- | ------------------------------------------------------------------------ |
|
|
256
|
+
| `dsn` | `str` | `None` | SDK disabled if empty; env: `SENTRY_DSN` |
|
|
257
|
+
| `environment` | `str` | `"production"` | e.g., `"staging"`; env: `SENTRY_ENVIRONMENT` |
|
|
258
|
+
| `release` | `str` | `None` | e.g., `"myapp@1.0.0"`; env: `SENTRY_RELEASE` |
|
|
259
|
+
| `send_default_pii` | `bool` | `False` | Include IP, headers, cookies, auth user, query strings (ASGI frameworks) |
|
|
260
|
+
| `traces_sample_rate` | `float` | `None` | Transaction sample rate; `None` disables tracing |
|
|
261
|
+
| `traces_sampler` | `Callable` | `None` | Custom per-transaction sampling (overrides rate) |
|
|
262
|
+
| `profile_session_sample_rate` | `float` | `None` | Continuous profiling session rate |
|
|
263
|
+
| `profile_lifecycle` | `str` | `"manual"` | `"trace"` = auto-start profiler with spans |
|
|
264
|
+
| `profiles_sample_rate` | `float` | `None` | Transaction-based profiling rate |
|
|
265
|
+
| `enable_logs` | `bool` | `False` | Send logs to Sentry (SDK ≥ 2.35.0) |
|
|
266
|
+
| `sample_rate` | `float` | `1.0` | Error event sample rate |
|
|
267
|
+
| `attach_stacktrace` | `bool` | `False` | Stack traces on `capture_message()` |
|
|
268
|
+
| `max_breadcrumbs` | `int` | `100` | Max breadcrumbs per event |
|
|
269
|
+
| `debug` | `bool` | `False` | Verbose SDK debug output |
|
|
270
|
+
| `before_send` | `Callable` | `None` | Hook to mutate/drop error events |
|
|
271
|
+
| `before_send_transaction` | `Callable` | `None` | Hook to mutate/drop transaction events |
|
|
272
|
+
| `ignore_errors` | `list` | `[]` | Exception types or regex patterns to suppress |
|
|
273
|
+
| `auto_enabling_integrations` | `bool` | `True` | Set `False` to disable all auto-detection |
|
|
274
|
+
|
|
275
|
+
#### `OTLPIntegration` Options (pass to constructor)
|
|
276
|
+
|
|
277
|
+
| Option | Type | Default | Purpose |
|
|
278
|
+
| ---------------------------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
279
|
+
| `setup_otlp_traces_exporter` | `bool` | `True` | Auto-configure OTLP exporter; set `False` if you send to your own Collector |
|
|
280
|
+
| `collector_url` | `str` | `None` | OTLP HTTP endpoint of an OTel Collector (e.g., `http://localhost:4318/v1/traces`); when set, spans are sent to the collector instead of directly to Sentry |
|
|
281
|
+
| `setup_propagator` | `bool` | `True` | Auto-configure Sentry propagator for distributed tracing |
|
|
282
|
+
| `capture_exceptions` | `bool` | `False` | Intercept exceptions recorded via OTel `Span.record_exception` |
|
|
283
|
+
|
|
284
|
+
### Environment Variables
|
|
285
|
+
|
|
286
|
+
| Variable | Maps to | Notes |
|
|
287
|
+
| -------------------- | ------------- | ----------------------------------------------------------------- |
|
|
288
|
+
| `SENTRY_DSN` | `dsn` | |
|
|
289
|
+
| `SENTRY_RELEASE` | `release` | Also auto-detected from git SHA, Heroku, CircleCI, CodeBuild, GAE |
|
|
290
|
+
| `SENTRY_ENVIRONMENT` | `environment` | |
|
|
291
|
+
| `SENTRY_DEBUG` | `debug` | |
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Verification
|
|
296
|
+
|
|
297
|
+
Test that Sentry is receiving events:
|
|
298
|
+
|
|
299
|
+
```python
|
|
300
|
+
# Trigger a real error event — check dashboard within seconds
|
|
301
|
+
division_by_zero = 1 / 0
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Or for a non-crashing check:
|
|
305
|
+
|
|
306
|
+
```python
|
|
307
|
+
sentry_sdk.capture_message("Sentry Python SDK test")
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
If nothing appears:
|
|
311
|
+
|
|
312
|
+
1. Set `debug=True` in `sentry_sdk.init()` — prints SDK internals to stdout
|
|
313
|
+
2. Verify the DSN is correct
|
|
314
|
+
3. Check `SENTRY_DSN` env var is set in the running process
|
|
315
|
+
4. For Celery/RQ: ensure init runs in the **worker** process, not just the calling
|
|
316
|
+
process
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Phase 4: Cross-Link
|
|
321
|
+
|
|
322
|
+
After completing Python setup, check for a companion frontend missing Sentry:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
ls frontend/ web/ client/ ui/ 2>/dev/null
|
|
326
|
+
cat frontend/package.json web/package.json client/package.json 2>/dev/null \
|
|
327
|
+
| grep -E '"react"|"svelte"|"vue"|"next"|"nuxt"'
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
If a frontend exists without Sentry, suggest the matching skill:
|
|
331
|
+
|
|
332
|
+
| Frontend detected | Suggest skill |
|
|
333
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
334
|
+
| React / Next.js | [`react`](../react/index.md) |
|
|
335
|
+
| Svelte / SvelteKit | [`svelte`](../svelte/index.md) |
|
|
336
|
+
| Vue / Nuxt | Use `@sentry/vue` — see [docs.sentry.io/platforms/javascript/guides/vue/](https://docs.sentry.io/platforms/javascript/guides/vue/) |
|
|
337
|
+
| Other JS/TS | [`react`](../react/index.md) (covers generic browser JS patterns) |
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## Troubleshooting
|
|
342
|
+
|
|
343
|
+
| Issue | Solution |
|
|
344
|
+
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
345
|
+
| Events not appearing | Set `debug=True`, verify DSN, check env vars in the running process |
|
|
346
|
+
| Malformed DSN error | Format: `https://<key>@o<org>.ingest.sentry.io/<project>` |
|
|
347
|
+
| Django exceptions not captured | Ensure `sentry_sdk.init()` is at the **top** of `settings.py` before other imports |
|
|
348
|
+
| Flask exceptions not captured | Init must happen **before** `app = Flask(__name__)` |
|
|
349
|
+
| FastAPI exceptions not captured | Init before `app = FastAPI()`; both `StarletteIntegration` and `FastApiIntegration` auto-enabled |
|
|
350
|
+
| ASGI chained exceptions suppressed | By default, Sentry’s ASGI middleware strips exception chains (`raise exc from None`). To preserve chained exceptions, set `_experiments={"suppress_asgi_chained_exceptions": False}` in `sentry_sdk.init()` |
|
|
351
|
+
| Celery task errors not captured | Must call `sentry_sdk.init()` in the **worker process** via `celeryd_init` signal |
|
|
352
|
+
| Sanic init not working | Init must be inside `@app.listener("before_server_start")`, not module level |
|
|
353
|
+
| uWSGI not capturing | Add `--enable-threads --py-call-uwsgi-fork-hooks` to uWSGI command |
|
|
354
|
+
| No traces appearing (native) | Verify `traces_sample_rate` is set (not `None`); check that the integration is auto-enabled |
|
|
355
|
+
| No traces appearing (OTLP) | Verify `sentry-sdk[opentelemetry-otlp]` is installed; do **not** set `traces_sample_rate` when using `OTLPIntegration` |
|
|
356
|
+
| Profiling not starting | Requires `traces_sample_rate > 0` + either `profile_session_sample_rate` or `profiles_sample_rate`; **not compatible with OTLP path** |
|
|
357
|
+
| `enable_logs` not working | Requires SDK ≥ 2.35.0; for direct structured logs use `sentry_sdk.logger`; for stdlib bridging use `LoggingIntegration(sentry_logs_level=...)` |
|
|
358
|
+
| Too many transactions | Lower `traces_sample_rate` or use `traces_sampler` to drop health checks |
|
|
359
|
+
| Cross-request data leaking | Don’t use `get_global_scope()` for per-request data — use `get_isolation_scope()` |
|
|
360
|
+
| Query strings not captured (ASGI) | Query strings and client IP in ASGI frameworks (FastAPI, Starlette, etc.) require `send_default_pii=True` |
|
|
361
|
+
| RQ worker not reporting | Pass `--sentry-dsn=""` to disable RQ’s own Sentry shortcut; init via settings file instead |
|