Overview
This quickstart guide will walk you through setting up Snuba locally and executing your first queries. You’ll learn how to start the services, run migrations, and query data using SnQL.This guide assumes you have Docker and Docker Compose installed. For other installation methods, see the Installation page.
Quick Start with Devservices
The fastest way to get started with Snuba is using the devservices setup, which automatically manages all dependencies.Start Services
Use devservices to start ClickHouse, Kafka, and Redis:This will start all required services in Docker containers:
- ClickHouse on ports 9000 (native) and 8123 (HTTP)
- Kafka on port 9093
- Redis on port 6379
Bootstrap and Migrate
Initialize the database and run migrations:
The
--force flag skips confirmation prompts. Remove it if you want to review changes before applying them.Your First Query
Now that Snuba is running, let’s execute some queries using SnQL (Snuba Query Language).Using the API Directly
Snuba exposes an HTTP API for executing queries. Here’s how to query the events dataset:Understanding the Query
Let’s break down the SnQL query structure:MATCH (entity)- Specifies which entity to query (events, transactions, metrics_counters, etc.)SELECT- Columns and aggregations to returnBY- Group by clause (similar to SQL’s GROUP BY)WHERE- Filter conditions (time range and project are typically required)ORDER BY- Sort orderLIMIT- Maximum number of rows to return
Sample Query Results
A successful query returns a JSON response with data and metadata:Common Query Patterns
Aggregations
SnQL supports various aggregation functions:Time Series with Granularity
Group data by time buckets:GRANULARITY specifies the time bucket size in seconds. Common values:60- 1 minute3600- 1 hour86400- 1 day
Tag Filtering
Query tags using subscript notation:Complex Conditions
Use functions and complex expressions:Using the Admin UI
Snuba includes a web-based admin interface for managing the system:Available Entities
Snuba provides multiple entities you can query. Common ones include:| Entity | Dataset | Description |
|---|---|---|
events | events | Error and issue events |
transactions | transactions | Performance transaction data |
metrics_counters | metrics | Counter metrics |
metrics_sets | metrics | Set metrics |
generic_metrics_distributions | metrics | Distribution metrics |
profiles | profiles | Profiling data |
replays | replays | Session replay data |
search_issues | search_issues | Issue search data |
eap_items | events_analytics_platform | EAP items |
Troubleshooting
Services Won’t Start
Port already in use
Port already in use
If ports 1218, 1219, 9000, 8123, or 6379 are already in use:
ClickHouse connection failed
ClickHouse connection failed
Ensure ClickHouse is running and healthy:
Migration errors
Migration errors
If migrations fail, you may need to reset:
Query Errors
Invalid entity error
Invalid entity error
Ensure you’re querying an entity that exists and using the correct dataset endpoint.Available endpoints:
/events/snql- Events dataset/transactions/snql- Transactions dataset/metrics/snql- Metrics dataset
Missing required time range
Missing required time range
Most queries require a time range filter:
Project ID required
Project ID required
Most entities require filtering by project_id:
Next Steps
Now that you have Snuba running:Learn More About Installation
Explore different installation methods including Docker Compose and production deployments
Query Language Reference
Deep dive into SnQL syntax, functions, and advanced query patterns
Configuration
Learn about configuring datasets, entities, and storages
API Reference
Complete API documentation for all endpoints and parameters
Development Workflow
For development, you can customize the devserver behavior:For more details on the CLI commands, run
snuba --help or snuba <command> --help.