getsentry / sentry-github-actions-app

This app allows your organization to instrument Github Actions with Sentry. You can use this to get insight of what parts of your CI are slow or failing often
MIT License
18 stars 8 forks source link
github instrumentation sentry tag-non-production

Sentry Github Actions App

codecov

NOTE: If this is a project you would like us to invest in, please let us know in this issue. You can try this app by following the steps in the "Try it out" section below.

This app allows your organization to instrument Github Actions with Sentry. You can use this to get insights of what parts of your CI are slow or failing often.

It works by listening to Github workflow events via a webhook configured in a Github App. These events are then stored in Sentry as performance transactions. The best value for this project is when you have Sentry's Discover and Dashboards in order to slice the data and answer the questions you care about. In a sense, this project turns Github's CI into an app which Sentry monitors, thus, you can use many of the features you're already familiar with.

NOTE: The Discover feature is only available on either a Business or Trial Plan.

NOTE: The Dashboards feature is only available on the Team Plan or higher.

There's likely products out there that can give you insights into Github's CI, however, this may be cheaper, it saves you having to add another vendor and your developers are already familiar with using Sentry.

Examples

This screenshot shows that you can group Github Actions through various tags in Sentry's Discover:

image

This screenshot shows the transaction view for an individual Github Action showing each step of the job:

image

Features

Here's a list of benefits you will get if you use this project:

Watch this video showing the features described above:

https://user-images.githubusercontent.com/44410/187217254-ad7c2eba-f4d4-4a08-9733-54cf92f466ec.mp4

Try it out

Steps to follow:

[sentry-github-actions-app]
; DSN value of the Sentry project you created in the
dsn = https://foo@bar.ingest.sentry.io/foobar

NOTE: In other words, we won't be able to access any of your code.

Give us feedback in this issue.

Local development

Prerequisites:

Set up:

python3 -m venv .venv
source .venv/bin/activate
pip install wheel
pip install -r requirements.txt -r requirements-dev.txt

You can ingest a single job without webhooks by using the cli. For example:

# This is a normal URL of a job on Github
python3 cli.py https://github.com/getsentry/sentry/runs/5759197422?check_suite_focus=true
# From test fixture
python3 cli.py tests/fixtures/jobA/job.json

Steps to ingest events from a repository:

Table of commands:

Command Description
flask run -p 5001 Start the Flask app on http://localhost:5001
pre-commit install Install pre-commit hooks
tox Run tests in isolated environment
pytest Run Python tests
pytest --cov=src --cov-report=html Generate code coverage.

Sentry staff info

Google Cloud Build will automatically build a Docker image when the code merges on main. Log-in to Google Cloud Run and deploy the latest image.