spryker-eco / new-relic
NewRelic module
Requires
- php: >=7.3
- psr/http-message: ^1.0.0
- spryker/guzzle: ^2.0.0
- spryker/kernel: ^3.30.0
- spryker/monitoring-extension: ^1.0.0
- spryker/symfony: ^3.1.0
Requires (Dev)
- phpstan/phpstan: ^1.2.0
- spryker/code-sniffer: *
- spryker/testify: *
Conflicts
This package is auto-updated.
Last update: 2026-03-18 11:12:24 UTC
README
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:
- Generate a New Relic User API key (replaces the old REST API key)
- Find your entity GUIDs in the New Relic UI (replaces application IDs)
- Set the new environment variables in your deploy configuration
- Update any project-level
NewRelicConfigoverrides to use the new method names
Facade Return Type
- 2.x:
NewRelicFacade::recordDeployment()returnedRecordDeploymentInterface - 3.x:
NewRelicFacade::recordDeployment()returnsvoid
Service Layer Architecture
- 2.x:
NewRelicMonitoringExtensionPlugincallednewrelic_*PHP functions directly inline - 3.x: Plugin delegates to
NewRelicServiceFactory::createNewRelicApi()which returns aNewRelicApiInterfacemodel
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, PHP8.3/8.4matrix,actions/checkout@v4 - PHPStan and Codeception test suites for all new code