File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 15
15
*/
16
16
class Newrelic extends Component implements BootstrapInterface
17
17
{
18
+ /**
19
+ * @var bool Enable agent
20
+ */
21
+ public $ enabled = true ;
18
22
/**
19
23
* @var \NewRelic\NewRelic
20
24
*/
@@ -45,6 +49,10 @@ class Newrelic extends Component implements BootstrapInterface
45
49
*/
46
50
public function bootstrap ($ app )
47
51
{
52
+ if (!$ this ->enabled ) {
53
+ return ;
54
+ }
55
+
48
56
if ($ this ->handler ) {
49
57
$ handler = new $ this ->handler (['newrelic ' => $ this ]);
50
58
} elseif ($ app instanceof \yii \web \Application) {
@@ -62,7 +70,7 @@ public function init()
62
70
{
63
71
parent ::init ();
64
72
65
- if (Agent::isLoaded ()) {
73
+ if ($ this -> enabled && Agent::isLoaded ()) {
66
74
$ this ->name = $ this ->name ? $ this ->name : \Yii::$ app ->name ;
67
75
$ this ->agent = new Agent ();
68
76
$ this ->agent ->setAppname ($ this ->name , $ this ->licence );
You can’t perform that action at this time.
0 commit comments