Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonw/datasette-sentry
Datasette plugin for configuring Sentry
https://github.com/simonw/datasette-sentry
datasette datasette-io datasette-plugin sentry
Last synced: 3 months ago
JSON representation
Datasette plugin for configuring Sentry
- Host: GitHub
- URL: https://github.com/simonw/datasette-sentry
- Owner: simonw
- License: apache-2.0
- Created: 2020-01-28T23:41:27.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-11-21T19:22:42.000Z (about 1 year ago)
- Last Synced: 2024-10-06T20:19:19.065Z (3 months ago)
- Topics: datasette, datasette-io, datasette-plugin, sentry
- Language: Python
- Size: 28.3 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# datasette-sentry
[![PyPI](https://img.shields.io/pypi/v/datasette-sentry.svg)](https://pypi.org/project/datasette-sentry/)
[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-sentry?include_prereleases&label=changelog)](https://github.com/simonw/datasette-sentry/releases)
[![Tests](https://github.com/simonw/datasette-sentry/workflows/Test/badge.svg)](https://github.com/simonw/datasette-sentry/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-sentry/blob/main/LICENSE)Datasette plugin for configuring Sentry for error reporting
## Installation
```bash
pip install datasette-sentry
```
## UsageThis plugin only takes effect if your `metadata.json` file contains relevant top-level plugin configuration in a `"datasette-sentry"` configuration key.
You will need a Sentry DSN - see their [Getting Started instructions](https://docs.sentry.io/error-reporting/quickstart/?platform=python).
Add it to `metadata.json` like this:
```json
{
"plugins": {
"datasette-sentry": {
"dsn": "https://[email protected]/PROJECTID"
}
}
}
```
Settings in `metadata.json` are visible to anyone who visits the `/-/metadata` URL so this is a good place to take advantage of Datasette's [secret configuration values](https://datasette.readthedocs.io/en/stable/plugins.html#secret-configuration-values), in which case your configuration will look more like this:
```json
{
"plugins": {
"datasette-sentry": {
"dsn": {
"$env": "SENTRY_DSN"
}
}
}
}
```
Then make a `SENTRY_DSN` environment variable available to Datasette.## Configuration
In addition to the `dsn` setting, you can also configure the Sentry [sample rate](https://docs.sentry.io/platforms/python/configuration/sampling/) by setting `sample_rate` to a floating point number between 0 and 1.
For example, to capture 25% of errors you would do this:
```json
{
"plugins": {
"datasette-sentry": {
"dsn": {
"$env": "SENTRY_DSN"
},
"sample_rate": 0.25
}
}
}
```### Performance monitoring
Sentry [Performance Monitoring](https://docs.sentry.io/product/performance/) records full traces of page for further analysis, in addition to tracking errors.
You can enable that by adding "enable_tracing" to your plugin configuration:
```json
{
"plugins": {
"datasette-sentry": {
"dsn": {
"$env": "SENTRY_DSN"
},
"enable_tracing": true
}
}
}
```
The default sample rate if you do this will be `1.0`, meaning every response will be traced. This can get expensive - you can adjust the tracing rate using `traces_sample_rate`. Set that to `0.1` to sample 10% of requests, for example:```json
{
"plugins": {
"datasette-sentry": {
"dsn": {
"$env": "SENTRY_DSN"
},
"enable_tracing": true,
"traces_sample_rate": 0.1
}
}
}
```