gramex icon indicating copy to clipboard operation
gramex copied to clipboard

ENH: Add sentry service

Open sanand0 opened this issue 2 years ago • 0 comments

Gramex integrates with Sentry out-of-box.

First, log into Sentry, create a project and copy the DSN key.

Then, add this to gramex.yaml:

sentry:
  dsn: "https://[email protected]/xxx"  # paste your DSN key

When Gramex reports any errors on the console, these are automatically sent to your Sentry instance. This works with self-hosted sentry too.

Gramex adds the following information to each error:

  1. The gramex tag set to the Gramex version (e.g. 1.92.0)
  2. The cwd tag is set to the current working directory (e.g. C:\temp\)
  3. The port tag is set to the port Gramex is running on (e.g. 9988)
  4. The user is set based on the current user object (e.g. {"id": "[email protected]", "role": "..."}

You can pass options to configure Sentry, like:

sentry:
  dsn: "https://[email protected]/xxx"  # paste your DSN key
  sample_rate: 0.1
  server_name: my-server.example.com
  environment: production

Currently, only scalar options (text, numbers, booleans) are supported, not functions.

sanand0 avatar Jul 03 '23 03:07 sanand0