Dockerized project to send sample errors, transactions, logs etc to Sentry (self-hosted via DSN) to ensure its features are working properly.
This project provides a containerized Python environment for testing Sentry's telemetry capabilities. It includes a comprehensive test script that continuously sends various types of data to your Sentry instance, allowing you to verify that all features are functioning correctly.
The test script sends the following telemetry data to Sentry:
- Errors: Various Python exception types (ZeroDivisionError, ValueError, IndexError, KeyError)
- Transactions: Distributed tracing with multiple spans (database queries, HTTP calls, data processing)
- Profiling: Continuous profiling of function execution
- Logs: Structured logging at different severity levels (INFO, WARNING, ERROR)
- Docker
- Docker Compose
- Clone the repository:
git clone <repository-url>
cd sentry-test- Create a
.envfile with your Sentry DSN:
cp .env.example .env
# Edit .env and add your actual Sentry DSN- Start the Docker environment:
docker compose up -dDependencies are automatically installed when the container starts.
To start sending telemetry data to Sentry:
docker compose exec sentry-test python test_sentry.pyThe script will:
- Send one sample of each telemetry type (error, trace, profiling, logs) every second
- Display what was sent in the console
- Continue running until you press
Ctrl+C
To access the container shell:
docker compose exec sentry-test bashdocker compose exec sentry-test python your_script.pyThe test script uses the following Sentry SDK configuration:
send_default_pii=True- Includes user data like request headers and IP addressesenable_logs=True- Forwards Python logs to Sentrytraces_sample_rate=1.0- Captures 100% of transactions for tracingprofile_session_sample_rate=1.0- Profiles 100% of sessions
SENTRY_DSN- Your Sentry Data Source Name (required)
.
├── compose.yaml # Docker Compose configuration
├── Dockerfile # Python 3.12 environment with debugging tools
├── entrypoint.sh # Auto-installs dependencies on container start
├── requirements.txt # Python dependencies (sentry-sdk)
├── test_sentry.py # Comprehensive Sentry telemetry test script
├── .env.example # Example environment variables
├── LICENSE # GNU General Public License v3.0
├── README.md # This file
└── CLAUDE.md # Development guide for Claude Code
- Base Image: Python 3.12 (slim-bookworm)
- Working Directory:
/app - Volume Mount: Current directory mounted for live code editing
- User: Runs as UID 1000:1000 (non-root)
- Packages: Installed locally in
/app/.pip_packages(persisted via volume)
After running the test script, check your Sentry instance for:
- Issues - Various error types should appear
- Performance - Transactions with spans should be visible
- Profiling - Function profiling data should be available
- Logs - Log entries at different severity levels
docker compose downThis project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.