Overview
Theadmin command starts Snuba’s administrative web interface, providing a web-based UI for managing and monitoring the Snuba system. The admin interface offers tools for query debugging, system status monitoring, and configuration management.
Options
Enable debug mode with auto-reload and detailed error pages.When enabled:
- Automatic code reloading on file changes
- Interactive debugger on errors
- Detailed stack traces in browser
- HTTP/1.1 protocol support
--processes and --threads must be 1.Logging level to use for the admin interface.Available levels:
critical- Only critical errorserror- Error messageswarning- Warnings and errorsinfo- Informational messagesdebug- Detailed debugging information
Number of worker processes to spawn (minimum: 1).
- Single process: Good for development or low-traffic deployments
- Multiple processes: Better for production with concurrent requests
--debug is enabled.Number of threads per worker process (minimum: 1).Threads within each process handle concurrent requests:
- Single thread: Serialized request handling
- Multiple threads: Concurrent request processing within the process
--debug is enabled.TCP socket connection backlog size (minimum: 128).Defines how many connections can queue waiting for acceptance:
- Lower values: Clients may see connection refused during load spikes
- Higher values: More connections can queue (more memory usage)
Configuration
The admin interface uses settings fromsnuba/settings.py:
Examples
Accessing the Admin Interface
Once started, the admin interface is available at:http://127.0.0.1:1219/
Available Features
The admin interface typically provides:Query Tool
Test and debug SnQL queries interactively with formatted results
System Status
Monitor system health, cluster status, and resource usage
Config Viewer
View current configuration and storage definitions
Tracing Tools
Debug query execution and performance issues
Deployment Modes
Development Mode
For local development with hot-reloading:In debug mode, the admin interface runs using Werkzeug’s development server with:
- Single-threaded operation
- Auto-reload on code changes
- Interactive debugger
- HTTP/1.1 support
http://127.0.0.1:1219/
Production Mode
For production deployments:- Runs using uWSGI for better performance
- Handles concurrent requests efficiently
- Suitable for production traffic
- No auto-reload (restart required for code changes)
Process Configuration
Choosing Process Count
- Single Process
- Multiple Processes
- Development environment
- Low traffic (< 10 requests/minute)
- Running on limited resources
- Debugging issues
- Simple debugging
- Lower memory usage
- Easier to reason about
- Limited concurrency
- Single point of failure
Calculating Workers
A common formula:Performance Tuning
Low-Traffic Deployment
Medium-Traffic Deployment
High-Traffic Deployment
Monitoring
Health Check
While the admin interface doesn’t expose a dedicated health endpoint, you can check if it’s running:Logs
Use appropriate log levels for monitoring:Process Monitoring
In production, monitor the admin interface processes:Integration with Snuba
The admin interface runs as a separate service from the main Snuba API:- Separate Services
- Development Server
Security Considerations
Troubleshooting
Port Already in Use
Port Already in Use
If the admin port is already bound:
Can't Start Multiple Processes in Debug
Can't Start Multiple Processes in Debug
Error: “processes/threads can only be 1 in debug”
Connection Refused
Connection Refused
If you can’t connect to the admin interface:
-
Verify it’s running:
-
Check the binding address:
-
Check firewall rules:
High Memory Usage
High Memory Usage
If consuming too much memory:
-
Reduce process count:
-
Monitor memory per process:
- Consider setting worker limits in uWSGI configuration
Slow Response Times
Slow Response Times
If the admin interface is slow:
-
Increase workers:
-
Check ClickHouse connectivity:
- Enable connection pooling in settings.py
-
Monitor query performance in logs:
Common Workflows
Local Development
Testing Admin Changes
Production Deployment
Environment Variables
The admin command respects:Next Steps
API Server
Learn about the main query API
Development Server
Start all services for development
Configuration
Configure Snuba settings
Monitoring
Monitor Snuba in production