GithubHelp home page GithubHelp logo

backend-monitoring's Introduction

Table of Contents

Installing Dependencies

This project uses Django 2.2 that requires Python 3

  1. Install Python 3:
brew install python3
  1. Install virtualenv and virtualenvwrapper
pip3 install virtualenv virtualenvwrapper
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
exec bash
  1. Install Sentry's command line tool to use release tracking and Github integration for commit data:
npm install -g @sentry/cli

This demo uses npm, pip, and virtualenv.

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
from sentry_sdk.integrations.django import DjangoIntegration

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

Further details on configuring Sentry here.

Running The Demo

Create a python-3 virtualenv (see below) and run deploy target in Makefile.

Virtualenv setup

Setup and activate a Python 3 virtual environment in the project root:

mkvirtualenv --python=python3 sentry-demo-django

To use virtualenv:

workon sentry-demo-django

Runing Django

Running the following command 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 excplicitly 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 virtualenv sentry-demo-django:

deactivate

To remove the virtualenv:

rmvirtualenv sentry-demo-django

backend-monitoring's People

Contributors

lssangha avatar idosun avatar helloncanella avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.