定制 aeatech/snapshot-profiler-newrelic 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aeatech/snapshot-profiler-newrelic

最新稳定版本:1.0.0

Composer 安装命令:

composer require aeatech/snapshot-profiler-newrelic

包简介

Snapshot profiler newrelic

README 文档

README

Code Coverage

The package contains implementation of aeatech/snapshot-profiler-contracts to profile applications with newrelic. It can be used for production profiling.

System requirements:

  • PHP >= 8.2
  • ext-newrelic (tested on 12.1+)

Installation (Composer):

composer require aeatech/snapshot-profiler-newrelic

Quick start

<?php
declare(strict_types=1);

use AEATech\SnapshotProfiler\Profiler;
use AEATech\SnapshotProfilerNewrelic\Adapter;
use AEATech\SnapshotProfilerNewrelic\Saver;

require_once 'vendor/autoload.php';

/**
 * Start initialization
 */
$saver = new Saver();
$adapter = new Adapter('appName', 'license');
$profiler = new Profiler($adapter);
$profilingOptions = [
    Adapter::OPTION_KEY_SNAPSHOT_NAME => 'snapshot name',
    /**
     * It must be true for cli processes or false for web processes
     */
    Adapter::OPTION_KEY_IS_BACKGROUND_PROCESS => true,
    Adapter::OPTION_KEY_CUSTOM_PARAMETERS => [
        'parameter 1' => true,
        'parameter 2' => 2,
        'parameter 3' => 3.14,
        'parameter 4' => 'string value',
    ],
];
/**
 * End initialization
 */

/**
 * Start profiling
 */
$profiler->enable();
$profiler->setProfilingOptions($profilingOptions);

for ($i = 0; $i < 10; $i++) {
    random_int(1, 10);
}

/**
 * $data is always empty and added for backward compatibility with xhprof
 */
$data = $profiler->disable();
/**
 * End profiling
 */

/**
 * Start customization (not necessarily)
 */

/**
 * Save profiling result
 * It's doing nothing and added for backward compatibility with xhprof
 */
$saver->save($data);

License

MIT License. See LICENSE for details.

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-18