承接 spryker-eco/new-relic 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

spryker-eco/new-relic

Composer 安装命令:

composer require spryker-eco/new-relic

包简介

NewRelic module

README 文档

README

CI Latest Stable Version License Minimum PHP Version

Provides a New Relic monitoring extension plugin and deployment tracking for Spryker applications.

Installation

composer require spryker-eco/new-relic

Documentation

Changelog: 2.x to 3.0 (Release Candidate)

Breaking Changes

PHP Requirement

  • 2.x: PHP >= 7.3
  • 3.x: PHP >= 8.3

Deployment Recording: REST API v2 to NerdGraph GraphQL

The New Relic REST API v2 (and its API keys) reached EOL on March 1, 2025. Version 3.x migrates deployment recording to the NerdGraph GraphQL API.

Environment variable changes:

2.x (removed) 3.x (new) Description
NEWRELIC:NEW_RELIC_DEPLOYMENT_API_URL NEWRELIC:NEW_RELIC_NERDGRAPH_API_URL API endpoint (default: https://api.newrelic.com/graphql)
NEWRELIC:NEW_RELIC_API_KEY NEWRELIC:NEW_RELIC_USER_API_KEY Authentication key (User API key instead of REST API key)
NEWRELIC:NEW_RELIC_APPLICATION_ID_ARRAY NEWRELIC:NEW_RELIC_ENTITY_GUID_ARRAY Entity identifiers (entity GUIDs instead of application IDs)

Config method changes in NewRelicConfig (Zed):

2.x (removed) 3.x (new)
getNewRelicDeploymentApiUrl() getNerdGraphApiUrl()
getNewRelicApiKey() getUserApiKey()
getNewRelicApplicationIdArray() getEntityGuidArray()

Console command changes:

The newrelic:record-deployment command arguments changed:

2.x 3.x
app_name (required) Removed (entity GUIDs come from env config)
revision (required) revision (required)
user (optional) user (optional)
description (optional) description (optional)
changelog (optional) changelog (optional)

Backward-compatible migration:

  1. Generate a New Relic User API key (replaces the old REST API key)
  2. Find your entity GUIDs in the New Relic UI (replaces application IDs)
  3. Set the new environment variables in your deploy configuration
  4. Update any project-level NewRelicConfig overrides to use the new method names

Facade Return Type

  • 2.x: NewRelicFacade::recordDeployment() returned RecordDeploymentInterface
  • 3.x: NewRelicFacade::recordDeployment() returns void

Service Layer Architecture

  • 2.x: NewRelicMonitoringExtensionPlugin called newrelic_* PHP functions directly inline
  • 3.x: Plugin delegates to NewRelicServiceFactory::createNewRelicApi() which returns a NewRelicApiInterface model

If you extended NewRelicMonitoringExtensionPlugin in your project, update your code to use the factory pattern:

// 2.x - direct function calls
newrelic_name_transaction($name);

// 3.x - via factory model
$this->getFactory()->createNewRelicApi()->nameTransaction($name);

New Features

Optional: Default Transaction Name Plugin

Spryker's spryker/monitoring module already sets route-based transaction names via ControllerListener plugins (e.g. homepage, Product/List/Index, storefront-api.catalog-search). This works well for requests that reach a controller.

However, requests that never reach routing — 404s, middleware rejections, health checks, early errors — fall back to New Relic's generic auto-naming (e.g. WebTransaction/Action/index), making them hard to identify.

The new optional NewRelicTransactionNameHandlerPlugin sets a meaningful default at boot time, before routing:

YVES:GET/en/cart
ZED:POST/api/products
GLUE:GET/catalog-search

Format: APPLICATION:HTTP_METHOD/path

For normal requests, the route-based name from ControllerListener overwrites this default later. For requests that never reach a controller, this default remains — giving visibility into otherwise unnamed transactions.

This plugin is optional. The module works without it, just like 2.x. To enable it, register it in the application plugins list. For Yves, add it to ShopApplicationDependencyProvider:

// src/Pyz/Yves/ShopApplication/ShopApplicationDependencyProvider.php

use SprykerEco\Service\NewRelic\Plugin\NewRelicTransactionNameHandlerPlugin;

protected function getApplicationPlugins(): array
{
    return [
        new YvesHttpApplicationPlugin(),
        // ... other plugins
        new NewRelicTransactionNameHandlerPlugin(), // should be registered early, before RouterApplicationPlugin
    ];
}

The same approach applies to Zed (ApplicationDependencyProvider) and Glue (GlueBackendApiApplication/GlueStorefrontApiApplication dependency providers).

CI Modernization

  • GitHub Actions: ubuntu-22.04, PHP 8.3/8.4 matrix, actions/checkout@v4
  • PHPStan and Codeception test suites for all new code

spryker-eco/new-relic 适用场景与选型建议

spryker-eco/new-relic 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.57M 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 05 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 spryker-eco/new-relic 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 spryker-eco/new-relic 我们能提供哪些服务?
定制开发 / 二次开发

基于 spryker-eco/new-relic 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.57M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 11
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-29