https://github.com/wieni/wmsentry
A module for sending errors to Sentry in Drupal 8.
https://github.com/wieni/wmsentry
crash-reporting drupal-8 drupal-module drupal8-module raven sentry sentry-client
Last synced: 3 months ago
JSON representation
A module for sending errors to Sentry in Drupal 8.
- Host: GitHub
- URL: https://github.com/wieni/wmsentry
- Owner: wieni
- License: mit
- Created: 2019-02-05T16:07:05.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-09-12T15:16:13.000Z (over 1 year ago)
- Last Synced: 2025-01-27T14:47:05.908Z (4 months ago)
- Topics: crash-reporting, drupal-8, drupal-module, drupal8-module, raven, sentry, sentry-client
- Language: PHP
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 9
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
wmsentry
======================[](https://packagist.org/packages/wieni/wmsentry)
[](https://packagist.org/packages/wieni/wmsentry)
[](https://packagist.org/packages/wieni/wmsentry)> A module for sending errors to Sentry in Drupal 9.
## Why?
- We use [Sentry](https://sentry.io) to monitor our sites and to track
errors
- We couldn't find an existing (stable) module for integrating Sentry
with Drupal, using v2 of the Sentry SDK.## Installation
This module requires PHP 8.0 or higher and uses the Sentry PHP package
([`sentry/sentry`](https://github.com/getsentry/sentry-php)), which is
not tied to any specific library that sends HTTP messages. Instead, it
uses [Httplug](https://github.com/php-http/httplug) to let users choose
whichever PSR-7 implementation and HTTP client they want to use.If you just want to get started quickly you should run the following command:
```bash
composer require wieni/wmsentry nyholm/psr7 php-http/guzzle6-adapter
```
For more information, please refer to the _Install_ section of the [`sentry/sentry-php`](https://github.com/getsentry/sentry-php#install) repository README.## How does it work?
### Configuration
Once enabled, you can configure the module through the settings form at
`/admin/config/development/logging/sentry`.To change the configuration of the module, users need the permission
`administer wmsentry settings`.To dynamically set the environment, release or other config values, you
can override the config in settings.php:
```php
$config['wmsentry.settings'] = [
'dsn' => $_ENV['SENTRY_DSN'],
'environment' => $_SERVER['APP_ENV'],
];
```### Events
#### `Drupal\wmsentry\WmsentryEvents::BEFORE_BREADCRUMB`
This function is called before the breadcrumb is added to the scope.
When nothing is returned from the function the breadcrumb is dropped.
The callback typically gets a second argument (called a “hint”) which
contains the original object that the breadcrumb was created from to
further customize what the breadcrumb should look like.#### `Drupal\wmsentry\WmsentryEvents::BEFORE_SEND`
This function can return a modified event object or nothing to skip
reporting the event. This can be used for instance for manual PII
stripping before sending.
#### `Drupal\wmsentry\WmsentryEvents::SCOPE_ALTER`
This function is called before the scope is added to the captured event.
The scope holds data that should implicitly be sent with Sentry events.
It can hold context data, extra parameters, level overrides,
fingerprints etc.
#### `Drupal\wmsentry\WmsentryEvents::OPTIONS_ALTER`
This function is called before the client is created with an options
object. The options object is a configuration container for the Sentry
client.### Setting the release ID through an HTTP endpoint
This module provides an HTTP endpoint that can be used to set the Sentry release ID without being logged in. This can
be useful when creating a new Sentry release through the API, eg. in a CI pipeline.The endpoint is `/sentry/set-release` and is secured in the same way as the `core/rebuild.php` script (see
[documentation](https://www.drupal.org/node/2153725)). The release ID can be passed using the `release` query parameter.
Here's an example call:
```
/sentry/set-release?release=exampleproject@62d50f53×tamp=1614934032&token=XXE6H4wwVC6x5I6QnTPFTj-hSksNfgUpndv9X-3lC7Y
```## Changelog
All notable changes to this project will be documented in the
[CHANGELOG](CHANGELOG.md) file.## Security
If you discover any security-related issues, please email
[[email protected]](mailto:[email protected]) instead of using the issue
tracker.## License
Distributed under the MIT License. See the [LICENSE](LICENSE) file
for more information.