Glitchtip: a Lightweight Sentry alternative
Sentry is fantastic, simply for any type of project. for those who don't know whats Sentry is, Sentry’s application monitoring platform helps every developer diagnose, fix, and optimize the performance of their code (based on the Sentry website). you can centralize your applications logs, tracing information and also, performance metrics. my recommendation is to use sentry in all of your production applications.
but if you want to use it as self-hosted, the sentry is a mess! if you use docker to start sentry, you have to start multiple services, like Kafka, Postgres, Redis, zookeeper, Clickhouse, and many more (check it yourself). and it’s too heavyweight for simple projects. in this case, you can use Glitchtip. you can consider Glitchtip as a Scaled down Sentry. Glitchtip lacks some features of the sentry, like charts, advanced queries, and many others, but do one thing well :). GlitchTip collects errors reported by your app and puts them all in one place for you to see.
Glitchtip developers do a smart move, they use Sentry SDK as their SDK. because of this selection, you can use pre-existed developed libraries of your selected language.
Getting start
- Install docker and docker-compose
- Create
docker-compose.yml
based on your environment and your requirements. this is an example:
version: "3.4"
x-environment: &default-environment
DATABASE_URL: postgres://postgres:postgres@postgres:15432/postgres
SECRET_KEY: change_me
PORT: 8000
x-depends_on: &default-depends_on
- postgres
- redisservices:
postgres:
image: postgres:12
environment:
POSTGRES_HOST_AUTH_METHOD: "trust"
restart: unless-stopped
ports:
- "15432:5432"
redis:
image: redis
restart: unless-stopped
web:
image: glitchtip/glitchtip
depends_on: *default-depends_on
ports:
- "8001:8000"
environment: *default-environment
restart: unless-stopped
worker:
image: glitchtip/glitchtip
command: celery -A glitchtip worker -B -l INFO
depends_on: *default-depends_on
environment: *default-environment
restart: unless-stopped
migrate:
image: glitchtip/glitchtip
depends_on: *default-depends_on
command: "./manage.py migrate"
environment: *default-environment
- Start containers:
docker-compose up
- Open Glitchtip web-UI and register your user and login
- Create organization and a project inside it
- Create a new project and install sentry SDK. for example in python:
pip install sentry-sdl
- Copy Client key endpoint, inside the project setting page
- Add SDK configuration inside your project. note: Glitchtip does not fix your port mappings. for my example, I should change the copied key port from 8000 to 8001
# app.pyimport sentry_sdk
import logging
sentry_sdk.init('http://e50cc1fd81a04f648cc8f7402ea48a59@localhost:8001/1') # change it with your client key
def main() -> None:
"""
Start function.
"""
logging.error("some error")
raise Exception('An Exception')
print("OK")
if __name__ == "__main__":
main()
- View the issues and logs