Search by

bliptrace / drupal

nasrulhazim.m

Drupal 10/11 module for Bliptrace — auto-captures exceptions via an event subscriber and ships them to the ingest API. Thin adapter over bliptrace/php.

Package info

github.com/bliptrace/bliptrace-drupal

Type:drupal-module

pkg:composer/bliptrace/drupal

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-11-26 23:19 UTC

This package is auto-updated.

Last update: 2026-11-27 01:59:56 UTC


README

A thin Drupal 10/11 module that auto-captures unhandled exceptions and ships them to the Bliptrace ingest API. It is a light adapter over the runtime PHP SDK, bliptrace/php — all the envelope building, scrubbing and transport live there; this module only wires Drupal's exception event into the SDK.

Drupal is built on Symfony, so the natural hook is a kernel exception event subscriber. The module subscribes to KernelEvents::EXCEPTION, enriches the exception with request context, and hands it to the SDK client.

Never breaks the site. Every step on the capture path is guarded. A misconfigured key, an unreachable ingest endpoint, or a slow network will never raise an error, stop event propagation, or alter the response — Drupal's own error handling continues exactly as before.

How capture works

  1. An unhandled Throwable triggers KernelEvents::EXCEPTION.
  2. ExceptionSubscriber forwards it (at a low priority, so it only observes) to the bliptrace.reporter service.
  3. The Reporter builds request context (method, URL, headers — with Authorization and Cookie stripped), then asks the bliptrace/php client to build, scrub and ship the envelope.
  4. The envelope is POSTed to endpoint (/v1/ingest is appended to a bare base URL) with an X-Ingest-Key header.

The project is never sent in the payload. It is resolved server-side from the ingest key. Only the key, endpoint and shaping options are configured here.

Install

Add the module via Composer:

composer require bliptrace/drupal

Then enable it:

drush en bliptrace
# or via the UI: Admin → Extend → enable "bliptrace"

Configure

Set the ingest key (and any overrides) in your site's settings.php. Source the key from the environment so it never lands in version control:

// settings.php
$settings['bliptrace'] = [
  'enabled'     => TRUE,
  'key'         => \Bliptrace\Php\Env::get('KEY'),   // BLIPTRACE_KEY (required)
  'endpoint'    => 'https://ingest.bliptrace.com/v1/ingest',
  'environment' => \Bliptrace\Php\Env::get('ENVIRONMENT', 'production'),
  'release'     => \Bliptrace\Php\Env::get('RELEASE'),
  'timeout'     => 3,
  // Optional shaping:
  'max_frames'        => 30,
  'max_message'       => 2000,
  'ignore_exceptions' => [],         // fully-qualified Throwable class names to skip
  'scrub_keys'        => ['password', 'token', 'secret'],
];

Env names: Bliptrace\Php\Env::get('KEY') (from bliptrace/php ^2.0) reads BLIPTRACE_KEY.

Setting Maps to Bliptrace\Php\Config Default
enabled enabled true
key key null (capture is off without it)
endpoint endpoint https://ingest.bliptrace.com/v1/ingest
environment environment production
release release null
timeout timeout 3
max_frames maxFrames 30
max_message maxMessage 2000
ignore_exceptions ignoreExceptions []
scrub_keys scrubKeys []

When enabled is false or key is empty, nothing is ever sent.

Service wiring

bliptrace.services.yml registers two services:

  • bliptrace.reporter — built by ReporterFactory::fromDrupalSettings() from the bliptrace array in settings.php.
  • bliptrace.exception_subscriber — tagged event_subscriber, listens for KernelEvents::EXCEPTION.

Development & tests

The test suite depends only on bliptrace/php (plus symfony/http-kernel to load the subscriber) — it never pulls in drupal/core. The testable pieces (Reporter, RequestContext, BliptraceSettings, ReporterFactory) are framework-light and live under the Bliptrace\Drupal\ namespace; the Drupal service class lives under Drupal\bliptrace\.

composer install
vendor/bin/pest

Licence

MIT. See LICENSE.