justbetter/magento2-inspectorapm

为 Magento 添加 Inspector APM 支持

安装: 4

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 4

分支: 0

开放问题: 0

类型:magento2-module

0.0.1 2024-06-04 14:53 UTC

This package is auto-updated.

Last update: 2024-09-04 15:18:13 UTC


README

``justbetter/module-inspectorapm``

主要功能

为 Magento 添加 Inspector APM 支持

安装

* = 在生产环境中请使用 --keep-generated 选项

Composer

  • 通过运行 composer require justbetter/module-inspectorapm 安装模块 composer
  • 通过运行 php bin/magento module:enable JustBetter_InspectorApm 启用模块
  • 通过运行 php bin/magento cache:flush 清除缓存

配置

添加

<?php
return [
    ...
    'inspector_apm' => [
        'ingestion_key' => '...',
        // Optional, default: https://ingest.inspector.dev
        'url' => '...',
    ],
    ...
]

到您的 env.php。

用法

数据库分析器

设置

<?php
return [
    ...
    'db' => [
        'connection' => [
            'default' => [
                ...
                'profiler' => [
                    'class' => 'JustBetter\\InspectorApm\\Profiler\\Driver\\DbProfiler',
                    'enabled' => true
                ]
            ]
        ]
    ],
    ...

在您的 env.php 中以启用数据库分析器。这将自动分析所有数据库事务。

Magento 分析器

运行 bin/magento inspector:enable 以启用常规分析器。

这将分析所有对 \Magento\Framework\Profiler::start 的调用,您可以在自己的代码中添加以测量其性能。

直接访问

如果您想禁用所有 Magento 和 Zend 提供的分析但仍然想分析一些函数,您可以使用依赖注入来获取 "\JustBetter\InspectorApm\Helper\Inspector" 并调用其任何底层函数。