CommunityProgramación y desarrollogithub.com

getsentry/sentry-python-sdk

Configuración completa del SDK de Sentry para Python. Útil cuando se pide 'añadir Sentry a Python', 'instalar sentry-sdk', 'configurar Sentry en Python' o establecer monitoreo de errores, trazado, perfilado, registro, métricas, crons o monitoreo de IA para aplicaciones Python. Compatible con Django, Flask, FastAPI, Celery, Starlette, AIOHTTP, Tornado y más.

¿Qué es sentry-python-sdk?

Esta skill proporciona una configuración completa del SDK de Sentry para aplicaciones Python. Está diseñada para ser utilizada cuando se solicite 'añadir Sentry a Python', 'instalar sentry-sdk' o 'configurar Sentry en Python', o para implementar monitoreo de errores, trazado distribuido, perfilado de rendimiento, registro estructurado, métricas, crons (tareas programadas) y monitoreo de aplicaciones de IA. Es compatible con una amplia gama de frameworks populares de Python, incluyendo Django, Flask, FastAPI, Celery, Starlette, AIOHTTP, Tornado y otros. La skill automatiza la instalación del paquete `sentry-sdk`, la inicialización del SDK con el DSN de Sentry y la configuración de integraciones específicas para cada framework. También incluye ejemplos de código y configuraciones para habilitar opciones avanzadas como el rastreo de rendimiento, la captura de logs y el monitoreo de métricas personalizadas. Es ideal para equipos de desarrollo que buscan una integración rápida y consistente de Sentry en sus proyectos Python, tanto para aplicaciones web como para servicios backend y sistemas de procesamiento de tareas asíncronas.

Compatible con~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/getsentry/sentry-for-ai/tree/main/skills/sentry-python-sdk

Installed? Explore more Programación y desarrollo skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

¿Qué hace sentry-python-sdk?

Configuración completa del SDK de Sentry para Python. Útil cuando se pide "añadir Sentry a Python", "instalar sentry-sdk", "configurar Sentry en Python" o establecer monitoreo de errores, trazado, perfilado, registro, métricas, crons o monitoreo de IA para aplicaciones Python. Compatible con Django, Flask, FastAPI, Celery, Starlette, AIOHTTP, Tornado y más.

Instalación

Para instalar el SDK de Sentry para Python, ejecuta:

pip install sentry-sdk

Para habilitar integraciones específicas, instala los extras correspondientes:

pip install sentry-sdk[django]
pip install sentry-sdk[flask]
pip install sentry-sdk[fastapi]
pip install sentry-sdk[celery]
pip install sentry-sdk[starlette]
pip install sentry-sdk[aiohttp]
pip install sentry-sdk[tornado]

Inicialización

Agrega la siguiente configuración al inicio de tu aplicación (por ejemplo, en settings.py para Django o en main.py para FastAPI):

import sentry_sdk

sentry_sdk.init(
    dsn="https://[email protected]/0",
    # Configura el porcentaje de transacciones a rastrear para rendimiento
    traces_sample_rate=1.0,
    # Habilita el perfilado
    profiles_sample_rate=1.0,
    # Habilita el registro de logs (requiere Python 3.7+)
    enable_tracing=True,
)

Variables de entorno

También puedes configurar el SDK usando variables de entorno:

  • SENTRY_DSN: El DSN de tu proyecto en Sentry.
  • SENTRY_ENVIRONMENT: El entorno (por ejemplo, "production", "staging").
  • SENTRY_RELEASE: La versión de tu aplicación.

Ejemplo:

export SENTRY_DSN="https://[email protected]/0"
export SENTRY_ENVIRONMENT="production"
export SENTRY_RELEASE="1.0.0"

Integraciones por framework

Django

Agrega sentry_sdk a INSTALLED_APPS y configura en settings.py:

INSTALLED_APPS = [
    ...
    'sentry_sdk',
]

import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

sentry_sdk.init(
    dsn="https://[email protected]/0",
    integrations=[DjangoIntegration()],
    traces_sample_rate=1.0,
    send_default_pii=True,
)

Flask

Configura en la creación de la aplicación:

from flask import Flask
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration

sentry_sdk.init(
    dsn="https://[email protected]/0",
    integrations=[FlaskIntegration()],
    traces_sample_rate=1.0,
)

app = Flask(__name__)

FastAPI

Configura en la creación de la aplicación:

from fastapi import FastAPI
import sentry_sdk
from sentry_sdk.integrations.fastapi import FastApiIntegration
from sentry_sdk.integrations.starlette import StarletteIntegration

sentry_sdk.init(
    dsn="https://[email protected]/0",
    integrations=[
        StarletteIntegration(),
        FastApiIntegration(),
    ],
    traces_sample_rate=1.0,
)

app = FastAPI()

Celery

Configura en el archivo de tareas:

from celery import Celery
import sentry_sdk
from sentry_sdk.integrations.celery import CeleryIntegration

sentry_sdk.init(
    dsn="https://[email protected]/0",
    integrations=[CeleryIntegration()],
    traces_sample_rate=1.0,
)

app = Celery('tasks', broker='redis://localhost:6379/0')

Otros frameworks

Para otros frameworks compatibles (Starlette, AIOHTTP, Tornado), consulta la documentación oficial de Sentry.

Funcionalidades avanzadas

  • Monitoreo de logs: Captura mensajes de log como eventos de Sentry.
  • Métricas: Envía métricas personalizadas.
  • Crons: Monitorea tareas programadas.
  • Monitoreo de IA: Rastrea solicitudes a modelos de lenguaje.

Para más detalles, visita: https://docs.sentry.io/platforms/python/

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

getsentry/sentry-android-sdk

Full Sentry SDK setup for Android. Use when asked to "add Sentry to Android", "install sentry-android", "setup Sentry in Android", or configure error monitoring, tracing, profiling, session replay, or logging for Android applications. Supports Kotlin and Java codebases.

getsentry/sentry-browser-sdk

Full Sentry SDK setup for browser JavaScript. Use when asked to "add Sentry to a website", "install @sentry/browser", or configure error monitoring, tracing, session replay, or logging for vanilla JavaScript, jQuery, static sites, or WordPress.

getsentry/sentry-cloudflare-sdk

Full Sentry SDK setup for Cloudflare Workers and Pages. Use when asked to "add Sentry to Cloudflare Workers", "install @sentry/cloudflare", or configure error monitoring, tracing, logging, crons, or AI monitoring for Cloudflare Workers, Pages, Durable Objects, Queues, Workflows, or Hono on Cloudflare.

getsentry/sentry-cocoa-sdk

Full Sentry SDK setup for Apple platforms (iOS, macOS, tvOS, watchOS, visionOS). Use when asked to "add Sentry to iOS", "add Sentry to Swift", "install sentry-cocoa", or configure error monitoring, tracing, profiling, session replay, logging, or metrics for Apple applications. Supports SwiftUI and UIKit.

getsentry/sentry-code-review

Analyze and resolve Sentry comments on GitHub Pull Requests. Use this when asked to review or fix issues identified by Sentry in PR comments. Can review specific PRs by number or automatically find recent PRs with Sentry feedback.

getsentry/sentry-create-alert

Create Sentry alerts using the workflow engine API. Use when asked to create alerts, set up notifications, configure issue priority alerts, or build workflow automations. Supports email, Slack, PagerDuty, Discord, and other notification actions.

getsentry/sentry-dotnet-sdk

Full Sentry SDK setup for .NET. Use when asked to "add Sentry to .NET", "install Sentry for C#", or configure error monitoring, tracing, profiling, logging, or crons for ASP.NET Core, MAUI, WPF, WinForms, Blazor, Azure Functions, or any other .NET application.

getsentry/sentry-elixir-sdk

Full Sentry SDK setup for Elixir. Use when asked to "add Sentry to Elixir", "install sentry for Elixir", or configure error monitoring, tracing, logging, or crons for Elixir, Phoenix, or Plug applications. Supports Phoenix, Plug, LiveView, Oban, and Quantum.

getsentry/sentry-feature-setup

Configure specific Sentry features beyond basic SDK setup. Use when asked to monitor AI/LLM calls, set up OpenTelemetry pipelines, create alerts and notifications, or enable span streaming.

getsentry/sentry-fix-issues

Find and fix issues from Sentry using MCP. Use when asked to fix Sentry errors, debug production issues, investigate exceptions, or resolve bugs reported in Sentry. Methodically analyzes stack traces, breadcrumbs, traces, and context to identify root causes.

getsentry/sentry-flutter-sdk

Full Sentry SDK setup for Flutter and Dart. Use when asked to "add Sentry to Flutter", "install sentry_flutter", "setup Sentry in Dart", or configure error monitoring, tracing, profiling, session replay, or logging for Flutter applications. Supports Android, iOS, macOS, Linux, Windows, and Web.

getsentry/sentry-go-sdk

Full Sentry SDK setup for Go. Use when asked to "add Sentry to Go", "install sentry-go", "setup Sentry in Go", or configure error monitoring, tracing, logging, metrics, or crons for Go applications. Supports net/http, Gin, Echo, Fiber, FastHTTP, Iris, Negroni, and gRPC.

getsentry/sentry-nestjs-sdk

Full Sentry SDK setup for NestJS. Use when asked to "add Sentry to NestJS", "install @sentry/nestjs", "setup Sentry in NestJS", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for NestJS applications. Supports Express and Fastify adapters, GraphQL, microservices, WebSockets, and background jobs.

getsentry/sentry-nextjs-sdk

Full Sentry SDK setup for Next.js. Use when asked to "add Sentry to Next.js", "install @sentry/nextjs", or configure error monitoring, tracing, session replay, logging, profiling, AI monitoring, or crons for Next.js applications. Supports Next.js 13+ with App Router and Pages Router.

getsentry/sentry-node-sdk

Full Sentry SDK setup for Node.js, Bun, and Deno. Use when asked to "add Sentry to Node.js", "add Sentry to Bun", "add Sentry to Deno", "install @sentry/node", "@sentry/bun", or "@sentry/deno", or configure error monitoring, tracing, logging, profiling, metrics, crons, or AI monitoring for server-side JavaScript/TypeScript runtimes.

getsentry/sentry-otel-exporter-setup

Configure the OpenTelemetry Collector with Sentry Exporter for multi-project routing and automatic project creation. Use when setting up OTel with Sentry, configuring collector pipelines for traces and logs, or routing telemetry from multiple services to Sentry projects.

getsentry/sentry-php-sdk

Full Sentry SDK setup for PHP. Use when asked to "add Sentry to PHP", "install sentry/sentry", "setup Sentry in PHP", or configure error monitoring, tracing, profiling, logging, metrics, or crons for PHP applications. Supports plain PHP, Laravel, and Symfony.

getsentry/sentry-pr-code-review

Review a project's PRs to check for issues detected in code review by Seer Bug Prediction. Use when asked to review or fix issues identified by Sentry in PR comments, or to find recent PRs with Sentry feedback.

getsentry/sentry-react-native-sdk

Full Sentry SDK setup for React Native and Expo. Use when asked to "add Sentry to React Native", "install @sentry/react-native", "setup Sentry in Expo", or configure error monitoring, tracing, profiling, session replay, or logging for React Native applications. Supports Expo managed, Expo bare, and vanilla React Native.

getsentry/sentry-react-sdk

Full Sentry SDK setup for React. Use when asked to "add Sentry to React", "install @sentry/react", or configure error monitoring, tracing, session replay, profiling, or logging for React applications. Supports React 16+, React Router v5-v7 non-framework mode, TanStack Router, Redux, Vite, and webpack.

Skills relacionados