Big Data 9 min read

Setting Up a Local Snuba Development Environment for Sentry Monitoring

This guide walks through cloning the Sentry and Snuba repositories, installing macOS system dependencies, configuring Python and Rust toolchains, launching Docker containers for ClickHouse, Kafka and Redis, running Snuba migrations, and finally starting the dev server to query events via a local UI.

Hacker Afternoon Tea
Hacker Afternoon Tea
Hacker Afternoon Tea
Setting Up a Local Snuba Development Environment for Sentry Monitoring

Clone Repositories

git clone https://github.com/getsentry/sentry.git
git clone https://github.com/getsentry/snuba.git

Install System Dependencies (macOS example)

Install Xcode command‑line tools and run the Brewfile in the sentry directory.

xcode-select --install
cd sentry
brew bundle --verbose

If Docker Desktop is already running, comment out the line cask 'docker' in the Brewfile.

Build Toolchain

Sentry requires pre‑built Python wheels for Linux (manylinux1) and macOS 10.15+. On other platforms install the Rust toolchain (see https://www.rust-lang.org/tools/install) so that binary modules can be compiled.

Python Environment

pyenv is installed by the Brew bundle. Create a virtual environment and activate it.

make setup-pyenv
python -m venv .venv
source .venv/bin/activate
which python   # should point to $HOME/.pyenv/shims/python

Start Sentry Services (excluding Snuba)

source .venv/bin/activate
sentry devservices up --exclude=snuba

Docker pulls and starts containers for Postgres, ClickHouse, Zookeeper, Kafka and Redis. Verify with docker ps.

Configure Snuba

cd snuba
make pyenv-setup
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip==21.1.3
make develop

Run Snuba Migrations

snuba migrations list   # shows pending migration files
snuba migrations migrate --force   # applies all migrations

Verify ClickHouse Tables

docker exec -it sentry_clickhouse clickhouse-client
select count() from sentry_local;

The query returns 0, confirming the tables are reachable.

Inspect Snuba Entities

snuba entities list
# discover, events, groups, …, transactions, sessions, …

Start Development Server

snuba devserver

Open http://localhost:1218/events/snql in a browser to view the simple SnQL UI.

Snuba UI screenshot
Snuba UI screenshot
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockerPythonDevOpsKafkaClickHouseSentrySnuba
Hacker Afternoon Tea
Written by

Hacker Afternoon Tea

You might find something interesting here ^_^

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.