GithubHelp home page GithubHelp logo

getsentry / sentry-round-robin Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 14.0 1.15 MB

Sample internal integration for Sentry that assigns new issues to users, round-robin style

JavaScript 100.00%
tag-archived

sentry-round-robin's Introduction

Sentry internal integration sample: Round robin issue assigment

This is a sample internal integration for Sentry that assigns new issues to users, round-robin style -- based on the users attached to a project at the time you start the server, this app will cycle through the users, assigning each new issue to a different user until everyone has been assigned. After each cycle, the list of users is reset and repeats again in the same order.

Note: This first version currently works for only one project at a time. You'll need to copy the project ID into your .env to configure (see setup steps below).

Setup

Local setup:

  1. Set up and run ngrok. (Note: This of course works best with a stable ngrok URL! Otherwise, you'll need to update the Sentry integration's webhook each time you restart ngrok.)

  2. Clone this repository.

  3. Run yarn install or npm install to install the dependencies.

  4. In the folder for this repo, change the name of the .env-sample file to .env.


Create a new internal integration in your Sentry organization:

  1. In the Sentry UI for your account, navigate to Settings > Developer Settings > New Internal Integration.

  2. Give the integration a title (for example, Round Robin Issue Assignment).

  3. Copy your ngrok URL into the "Webhook URL" field.

  4. Set the required permissions: "Issue & Event" requires Read & Write, and "Organization" requires Read.

  5. Check the box for "issue" under the "Webhooks" section to be notified when issued are created, resolved, or assigned.

  6. Press "Save Changes" on the bottom right

  7. From the bottom of the "Internal Integrations" page in the Sentry UI, under the "Tokens" section, copy the integration's token -- you'll need to paste this into your .env file next.


Set environment variables in the .env file:

Note: remember to change the name of the .env-sample file to .env.

  • SENTRY_TOKEN=yourtokenhere -- Paste your integration's token (see previous step above).

  • SENTRY_ORG -- Copy your organization name from the Sentry UI under Settings > General under "Name".

  • SENTRY_DSN -- Copy the DSN for your chosen project from Settings > Projects > Your Project > Client Keys (DSN).

  • SENTRY_PROJECT_ID -- You can get your project ID by going to Projects in the Sentry UI, clicking on your chosen project, and copying the ID from the end of the URL; for example, sentry.io/organizations/yourorg/issues/?project=1234567.

  • PORT -- Enter the port number for your local Node.js server (for example, 8000).


Run it!

  1. Make sure ngrok is running (and that it matches the webhook URL you entered for your internal integration in the Sentry UI).

  2. Run yarn start or npm start to start the server. Create a brand new issue in your chosen Sentry project to test it out; within a couple minutes, the issue should be assigned to one of that project's users!

Running tests

This app uses Jest for tests. Run the tests via the console with yarn test or npm run test.

sentry-round-robin's People

Contributors

benvinegar avatar learningnerd avatar nolachen avatar scefali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sentry-round-robin's Issues

Handle case where next user to be assigned no longer exists

In this first proof-of-concept, if a user no longer exists or no longer has access to the given project, the most recent issue will not be assigned to anyone.

If the user no longer exists or has project access, Sentry's response has status code 400 and the body is {"assignedTo":["Unknown actor input"]}.

Next step: for now, just attempt to assign the next user in the queue, going through the whole queue until either a user is found or the queue is empty. If the queue is empty, repopulate it with an updated list of users with another API call.

Prevent issues created in other projects from being assigned

If a user in the specified project is a part of multiple projects, new issues for any of those projects will have the round robin assignments applied to them

Basically the SENTRY_PROJECT_ID env variable specifies which users to assign in round robin (members of that project), but webhook requests will be sent for issues created in any project in the organization.

When an issue is created in a project that is not SENTRY_PROJECT_ID, a webhook request is still sent and the Round Robin app attempts to assign the issue to the user list from the SENTRY_PROJECT_ID project. This "works" if there are any overlapping users, but if there is no user that belongs to the project, then the app throws an error

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.