Documentation Index
Fetch the complete documentation index at: https://mintlify.com/getsentry/snuba/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Thedevserver command provides a convenient way to start all necessary Snuba services for local development. It handles bootstrapping, migrations, and orchestrates multiple processes including the API server, consumers, and background workers.
Options
- Creating Kafka topics (unless
--no-migrateis used with bootstrap) - Running database migrations
--no-bootstrap to skip initialization if your environment is already set up.--workers: Starts all services including consumers and processors
With --no-workers: Starts only the API servercritical- Only critical errorserror- Error messageswarning- Warnings and errorsinfo- Informational messages (default)debug- Detailed debugging outputtrace- Verbose trace-level logging (for Rust consumers)
What Gets Started
The devserver starts different services based on configuration and feature flags:Core Services (Always)
API Server
http://localhost:1218Admin Interface
http://localhost:1219Data Processing (When —workers enabled)
Transaction Processing
Transaction Processing
- transaction-consumer - Processes transaction/span events
- Command:
snuba rust-consumer --storage=transactions - Consumer group:
transactions_group
Error Processing
Error Processing
- errors-consumer - Processes error events
- replacer - Handles data replacements and updates
- Consumer group:
errors_group
Outcomes Processing
Outcomes Processing
- outcomes-consumer - Standard outcomes
- outcomes-billing-consumer - Billing outcomes from separate topic
- Consumer group:
outcomes_group/outcomes_billing_group
Subscriptions
Subscriptions
subscriptions-scheduler-executor-eventssubscriptions-scheduler-executor-transactionssubscriptions-scheduler-executor-eap-items
subscriptions-scheduler-events+subscriptions-executor-eventssubscriptions-scheduler-transactions+subscriptions-executor-transactionssubscriptions-scheduler-eap-items+subscriptions-executor-eap-items
Optional Services (Feature Flags)
Metrics (ENABLE_SENTRY_METRICS_DEV)
Metrics (ENABLE_SENTRY_METRICS_DEV)
- metrics-consumer - Legacy metrics
- generic-metrics-distributions-consumer
- generic-metrics-sets-consumer
- generic-metrics-counters-consumer
- generic-metrics-gauges-consumer
ENABLE_METRICS_SUBSCRIPTIONS is also enabled:- Subscription schedulers and executors for each metric type
Profiles (ENABLE_PROFILES_CONSUMER)
Profiles (ENABLE_PROFILES_CONSUMER)
- profiles - Profile data consumer
- profile_chunks - Profile chunks consumer
- functions - Functions data consumer
Replays (ENABLE_REPLAYS_CONSUMER)
Replays (ENABLE_REPLAYS_CONSUMER)
- replays-consumer - Session replay events
Issues (ENABLE_ISSUE_OCCURRENCE_CONSUMER)
Issues (ENABLE_ISSUE_OCCURRENCE_CONSUMER)
- issue-occurrence-consumer - Generic issue events
Group Attributes (ENABLE_GROUP_ATTRIBUTES_CONSUMER)
Group Attributes (ENABLE_GROUP_ATTRIBUTES_CONSUMER)
- group-attributes-consumer - Group attribute updates
Lightweight Deletions (ENABLE_LW_DELETIONS_CONSUMER)
Lightweight Deletions (ENABLE_LW_DELETIONS_CONSUMER)
- lw-deletions-consumer - Processes deletion requests
EAP Items (Always enabled in dev)
EAP Items (Always enabled in dev)
- eap-items-consumer - Events Analytics Platform items
- Uses RowBinary format
Examples
Startup Sequence
When you runsnuba devserver, the following happens:
Bootstrap (if enabled)
snuba bootstrap --force --no-migrate to create Kafka topics.If this fails and --workers is enabled, the command exits immediately.Migrations
snuba migrations migrate --force to apply all pending database migrations.If this fails, the command exits immediately.--no-workers is specified, the bootstrap phase still runs (unless --no-bootstrap is also used), but only the API server process is started.Default Consumer Configuration
All Rust consumers started by devserver use these common options:- Uses Rust-based message processing for performance
- Starts consuming from the latest messages (doesn’t replay old data)
- Allows offset reset even when offsets exist
- Enforces schema validation on incoming messages
- Uses the log level specified via
--log-leveloption
Process Management
Viewing Logs
All process logs are multiplexed to stdout with the process name prefix:Stopping Services
PressCtrl+C to gracefully stop all services. Honcho will:
- Send SIGTERM to all processes
- Wait for graceful shutdown
- Report exit codes
Exit Codes
The devserver command exits with:0- All services shut down cleanly>0- Bootstrap or migration failure, or one or more services crashed
Configuration
The devserver respects various settings fromsnuba/settings.py:
Service Endpoints
Service Endpoints
HOST/PORT- API server binding (default: 127.0.0.1:1218)ADMIN_HOST/ADMIN_PORT- Admin interface (default: 127.0.0.1:1219)
Feature Flags
Feature Flags
ENABLE_SENTRY_METRICS_DEV- Enable metrics consumersENABLE_PROFILES_CONSUMER- Enable profiling consumersENABLE_REPLAYS_CONSUMER- Enable replay consumerENABLE_ISSUE_OCCURRENCE_CONSUMER- Enable issue consumerENABLE_GROUP_ATTRIBUTES_CONSUMER- Enable group attributesENABLE_LW_DELETIONS_CONSUMER- Enable lightweight deletionsENABLE_METRICS_SUBSCRIPTIONS- Enable metrics subscriptions
Subscription Mode
Subscription Mode
SEPARATE_SCHEDULER_EXECUTOR_SUBSCRIPTIONS_DEV- Run scheduler/executor separately- Default:
false(combined scheduler-executor)
Common Workflows
First Time Setup
Daily Development
Debugging Issues
Reset Environment
Troubleshooting
Bootstrap Fails
Bootstrap Fails
- Check that Kafka is running
- Verify Kafka configuration in settings
- Try with longer timeout:
Migration Errors
Migration Errors
Consumer Won't Start
Consumer Won't Start
- Check the specific consumer logs in the output
- Verify storage configuration
- Ensure Kafka topics exist:
- Check ClickHouse connections:
Port Already in Use
Port Already in Use
Out of Memory
Out of Memory
- Start with fewer services:
- Disable optional consumers in settings.py
- Reduce consumer batch sizes in source code
Environment Variables
The devserver sets:Performance Tips
Faster Restarts
Resource Usage
To reduce resource usage during development:-
Disable unnecessary features in
settings.py: -
Start API only when not testing consumers:
-
Use latest offset to avoid processing old data:
- Already configured in devserver default options
Integration with Sentry Development
When developing Sentry locally:- Start Sentry’s dependencies (including Kafka, ClickHouse)
- Start Snuba devserver:
- Start Sentry development server
- Generate events through Sentry UI or SDK
- Query data through Snuba API or Sentry