Export sentry project's metrics consistent with the Prometheus exposition formats
- python >= 3.7.9
- Sentry API auth token
Authentication token permissions:
project:readorg:readproject:releasesevent:read
pip install -r requirements.txtexport SENTRY_BASE_URL="https://sentry.io/api/0/"
export SENTRY_AUTH_TOKEN="[REPLACE_TOKEN]"
export SENTRY_EXPORTER_ORG="[ORGANIZATION_SLUG]"python exporter.pyRun
docker run --name sentry-exporter -e SENTRY_AUTH_TOKEN=[REPLACE_TOKEN] -e SENTRY_EXPORTER_ORG=[ORGANIZATION_SLUG] italux/sentry-prometheus-exporterBuild local image
docker-compose buildCreate a .env file
echo SENTRY_BASE_URL="https://sentry.io/api/0/"
echo SENTRY_AUTH_TOKEN="[REPLACE_TOKEN]"
echo SENTRY_EXPORTER_ORG="[organization_slug]"Start containers
docker-compose up -dsentry_open_issue_events: A Number of open issues (aka is:unresolved) per project in the past 1hsentry_issues: Gauge Histogram of open issues split into 3 buckets: 1h, 24h, and 14dsentry_events: Total events counts per project
By default all metrics are scraped, however, issue or event-related metrics can be disabled by setting the relevant variable to False:
export SENTRY_SCRAPE_ISSUE_METRICS=False
export SENTRY_SCRAPE_EVENT_METRICS=FalseBy default, if SENTRY_SCRAPE_ISSUE_METRICS=True or is unset issue metrics are scraped for 1hour, 24hours and 14days. Any of these can be disabled by setting the relevant variable to False:
export SENTRY_ISSUES_1H=False
export SENTRY_ISSUES_24H=False
export SENTRY_ISSUES_14D=FalseAs with SENTRY_AUTH_TOKEN, all of these variables can be passed in through the docker run -e VAR_NAME=<> command or via the .env file if using Docker Compose.
Grafana Dashboard
Sentry Issues & Events Overview

Prometheus configuration: prometheus.yml
scrape_configs:
- job_name: 'sentry_exporter'
static_configs:
- targets: ['sentry-exporter:9790']
scrape_interval: 5m
scrape_timeout: 4m- Performance: The exporter is serial, if your organization has a high number of issues & events you may experience
Context Deadline Exceedederror during a Prometheus scrape
- Use
scrape_interval: 5mminimum.
This value will be defined by the number of new issues and events
higher number of events will take more time
- Use a high
scrape_timeoutfor the exporter job
General recomendation is to set
scrape_interval - 1(i.e.:4m)
- If the scraping of particular metrics are disabled the values above can be reduced depending on your setup.
Sentry Prometheus Exporter documentation
Contributions, issues and feature requests are welcome!
- Feel free to check issues page.
Copyright © 2021 Italo Santos.
This project is GNU General Public License v2.0 licensed.
Give a ⭐️ if this project helped you!
👤 Italo Santos
- Website: http://italosantos.com.br
- Twitter: @italux
- Github: @italux
- LinkedIn: @italosantos
This README was generated with by readme-md-generator