Skip to content

sentry-tutorials/backend-monitoring

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

Installing Dependencies

This project uses Django 2.2 that requires Python 3

  1. Install Python:
brew install python
  1. Create virtual environment
python -m venv .venv
  1. Activate virtual environment
source .venv/bin/activate
  1. Install Sentry's command line tool to use release tracking and Github integration for commit data:
python -m pip install "sentry-cli"

Configuring Sentry

The Sentry client library requires a DSN generated from Sentry which specifies the project events will be sent to. Add the import and configuration code to settings.py:

import sentry_sdk

sentry_sdk.init(
    dsn="https://[email protected]/1234567"
)

Further details on configuring Sentry here.

Running The Demo

Run deploy target in Makefile. This will install relevant python libraries and run Django server.

make deploy

Demo Specs

This demo uses Django's rest-framework package and offers 3 API endpoints:

  1. http://localhost:8000/handled - generates a runtime error explicitly reported to Sentry though the SDK's captureException
  2. http://localhost:8000/unhandled - generates an unhandled runtime error reported
  3. http://localhost:8000/checkout - can be used with the Sentry REACT demo store front demo This endpoint can also be used with directly through the Django REST Framework web UI. To generate an error paste the following JSON payload in the POST payload text area:
    {
    "cart": [
        {"id": "wrench", "name": "Wrench", "price": 500},
        {"id": "wrench", "name": "Wrench", "price": 500}
    ],
    "email": "[email protected]"
    }

Alt Text

Cleaning Up

Pressing Ctrl-C once in each terminal window should stop Django's development server.

To deactivate the virtual environment:

deactivate

To remove the virtual environment:

rm -rf .venv/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 95.2%
  • Makefile 4.8%