Skip to content

Commit 33ed62a

Browse files
ACPT-1584
Now using NewRelicWrapper
1 parent c94b677 commit 33ed62a

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

app/code/Magento/ApplicationPerformanceMonitorNewRelic/Profiler/Output/NewRelicOutput.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\ApplicationPerformanceMonitor\Profiler\Metric;
1111
use Magento\ApplicationPerformanceMonitor\Profiler\OutputInterface;
1212
use Magento\Framework\App\DeploymentConfig;
13+
use Magento\NewRelicReporting\Model\NewRelicWrapper;
1314

1415
/**
1516
* Outputs the performance metrics and other information to New Relic
@@ -19,10 +20,7 @@ class NewRelicOutput implements OutputInterface
1920
public const CONFIG_ENABLE_KEY = 'application/performance_monitor/newrelic_output_enable';
2021
public const CONFIG_VERBOSE_KEY = 'application/performance_monitor/newrelic_output_verbose';
2122

22-
/**
23-
* @param DeploymentConfig $deploymentConfig
24-
*/
25-
public function __construct(private DeploymentConfig $deploymentConfig)
23+
public function __construct(private DeploymentConfig $deploymentConfig, private NewRelicWrapper $newRelicWrapper)
2624
{
2725
}
2826

@@ -31,7 +29,7 @@ public function __construct(private DeploymentConfig $deploymentConfig)
3129
*/
3230
public function isEnabled(): bool
3331
{
34-
if (!extension_loaded('newrelic')) {
32+
if (!$this->newRelicWrapper->isExtensionInstalled()) {
3533
return false;
3634
}
3735
return match ($this->deploymentConfig->get(static::CONFIG_ENABLE_KEY)) {
@@ -49,14 +47,14 @@ public function doOutput(array $metrics, array $information)
4947
return;
5048
}
5149
foreach ($information as $key => $value) {
52-
newrelic_add_custom_parameter($key, $value);
50+
$this->newRelicWrapper->addCustomParameter($key, $value);
5351
}
5452
$verbose = $this->isVerbose();
5553
foreach ($metrics as $metric) {
5654
if (!$verbose && $metric->isVerbose()) {
5755
continue;
5856
}
59-
newrelic_add_custom_parameter($metric->getName(), $metric->getValue());
57+
$this->newRelicWrapper->addCustomParameter($metric->getName(), $metric->getValue());
6058
}
6159
}
6260

app/code/Magento/ApplicationPerformanceMonitorNewRelic/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"php": "~8.1.0||~8.2.0",
1616
"magento/framework": "*",
1717
"magento/module-application-performance-monitor": "*",
18-
"magento/module-application-new-relic": "*"
18+
"magento/module-new-relic-reporting": "*"
1919
},
2020
"suggest": {
2121
"ext-newrelic": "This module requires New Relic's PHP extension in order to function."

0 commit comments

Comments
 (0)