Skip to content

Commit 2ad6881

Browse files
author
Vasiliy Ostanin
committed
upgrade newrelic lib
1 parent 5590b5d commit 2ad6881

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

Newrelic.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use bazilio\yii\newrelic\handlers\BaseHandler;
66
use bazilio\yii\newrelic\handlers\ConsoleHandler;
77
use bazilio\yii\newrelic\handlers\WebHandler;
8-
use NewRelic\NewRelic as Agent;
8+
use SobanVuex\NewRelic\Agent;
99
use yii\base\BootstrapInterface;
1010
use yii\base\Component;
1111

@@ -20,7 +20,7 @@ class Newrelic extends Component implements BootstrapInterface
2020
*/
2121
public $enabled = true;
2222
/**
23-
* @var \NewRelic\NewRelic
23+
* @var Agent
2424
*/
2525
public $agent;
2626

@@ -71,7 +71,7 @@ public function init()
7171
parent::init();
7272

7373
if ($this->enabled) {
74-
if (Agent::isLoaded()) {
74+
if (extension_loaded('newrelic')) {
7575
$this->name = $this->name ? $this->name : \Yii::$app->name;
7676
$this->agent = new Agent();
7777
$this->agent->setAppname($this->name, $this->licence);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
],
1313
"require": {
14-
"sobanvuex/php-newrelic": "1.*",
14+
"sobanvuex/php-newrelic": "^2.0",
1515
"php": ">=5.4.0",
1616
"yiisoft/yii2": "*"
1717
},

handlers/BaseHandler.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ class BaseHandler extends Handler
88
{
99
public function bootstrap($app)
1010
{
11-
$app->on(
12-
Application::EVENT_BEFORE_REQUEST,
13-
function () use ($app) {
14-
$this->getAgent()->startTransaction($this->newrelic->name);
15-
}
16-
);
17-
1811
$app->on(
1912
Application::EVENT_BEFORE_ACTION,
2013
function () use ($app) {
@@ -25,12 +18,5 @@ function () use ($app) {
2518
. $app->requestedAction->id);
2619
}
2720
);
28-
29-
$app->on(
30-
Application::EVENT_AFTER_REQUEST,
31-
function () use ($app) {
32-
$this->getAgent()->endOfTransaction();
33-
}
34-
);
3521
}
36-
}
22+
}

0 commit comments

Comments
 (0)