Magento

Module for Magento 2.4 and Adobe Commerce

Free on every plan, including the free one
Where to get it Packagist
Requirements Magento Open Source or Adobe Commerce 2.4.4+, Mage-OS, PHP 8.1+
Package name dockcodes/dock-ray-magento
Pricing Free

What it is for

The DockRay module for Magento 2 integrates your store with the DockRay error monitoring platform and automatically reports PHP exceptions and errors logged by Magento. Issues from controllers, REST and GraphQL APIs, payment and shipping integrations, and cron jobs are sent directly to your DockRay dashboard, helping you diagnose problems in Magento Open Source and Adobe Commerce.

PHP Error and Exception Monitoring

DockRay collects information about errors that occur while your store is running, including exceptions handled by Magento's error handling mechanisms and events recorded in logs as errors. This helps you detect issues with application behavior, third-party integrations, and background processes more quickly.

Performance Monitoring and JavaScript Errors

Optional Magento route response time monitoring helps identify slow parts of your application. Measurements are grouped by route name rather than individual product URLs, making it easier to analyze performance without splitting results across multiple similar URLs.

The module can also collect JavaScript errors occurring on your storefront. This mechanism works even when full-page caching is enabled, allowing you to monitor browser-side issues without sacrificing your store's performance optimizations.

Known Vulnerability Detection in Magento

DockRay analyzes your store's software inventory, including the Magento version, Composer packages, and extensions located in the app/code directory, to identify known vulnerabilities. Results are available in the DockRay dashboard and help you identify components that may require updates or further security review.

Easy Configuration and Secure Key Storage

Configure the connection under Stores → Configuration → DockRay → Monitoring by entering your project token and private key. To avoid storing credentials in the Magento database, you can store the private key in app/etc/env.php or provide it through an environment variable.

DockRay for Magento helps you monitor application errors, analyze route performance, and identify known extension vulnerabilities from a single dashboard, without having to manually review all your store logs.

Installation

Requirements

The DockRay module supports Magento Open Source and Adobe Commerce version 2.4.4 or later, as well as Mage-OS. It requires PHP 8.1 or later.

Install via Composer

Install the DockRay module from the root directory of your Magento project using Composer:

bash
composer require dockcodes/dock-ray-magento
bin/magento module:enable DockCodes_DockRay
bin/magento setup:upgrade

# In production mode, also run:

bin/magento setup:di:compile
bin/magento setup:static-content:deploy

Configure the DockRay Connection

In the Magento admin panel, navigate to Stores → Configuration → DockRay → Monitoring. Enter the project token and private key available in your DockRay dashboard, then save the configuration.

If you prefer not to store the private key in the Magento database, you can configure the credentials using CLI commands:

bash
bin/magento config:set --lock-env dockray/connection/token YOUR_PROJECT_TOKEN
bin/magento config:set --lock-env dockray/connection/private_key YOUR_PRIVATE_KEY

The --lock-env option stores configuration at the environment scope. Values configured this way are locked in the admin panel and are supplied by the environment configuration.

Store the Private Key Outside the Database

You can store the private key in app/etc/env.php or provide it through an environment variable:

php
'dockray' => [
    'connection' => [
        'private_key' => 'YOUR_PRIVATE_KEY',
    ],
],

Alternatively, use the CONFIG__DEFAULT__DOCKRAY__CONNECTION__PRIVATE_KEY environment variable. Keeping secrets out of the database helps you manage access to credentials more securely.

Verify the Installation

After saving the configuration, send a test event to verify the connection to your DockRay project. You can run the test from the terminal:

bash
bin/magento dockray:test

Then open your DockRay project and check whether the new event has arrived. Reports about known vulnerabilities are sent periodically through Magento cron. You can also trigger a report manually:

bash
bin/magento dockray:inventory:send

How to use it

The integration reports exceptions on its own. This is for the reports you send deliberately.

php
<?php

use DockCodes\DockRay\Model\Reporter;

class SyncStock
{
    public function __construct(
        private Reporter $dockray
    ) {}

    public function execute(): void
    {
        try {
            $this->erp->pushStock();
        } catch (\Throwable $e) {
            // Report the ERP integration exception to DockRay.

            $this->dockray->captureException($e);
        }
    }
}

Knowledge base articles

Start Monitoring

Connect your first application and get full visibility into what’s happening in production.

DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.