1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of Ekino New Relic bundle. |
7
|
|
|
* |
8
|
|
|
* (c) Ekino - Thomas Rabaix <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Ekino\NewRelicBundle\NewRelic; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* This interactor does never assume that the NewRelic extension is installed. It will check |
18
|
|
|
* for the existence of the NewRelic extension every time this is class is instantiated. This |
19
|
|
|
* is a good interactor to use when you want to enable and disable the NewRelic extension |
20
|
|
|
* without rebuilding your container. |
21
|
|
|
* |
22
|
|
|
* @author Tobias Nyholm <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
class AdaptiveInteractor implements NewRelicInteractorInterface |
25
|
|
|
{ |
26
|
|
|
private $interactor; |
27
|
|
|
|
28
|
|
|
public function __construct(NewRelicInteractorInterface $real, NewRelicInteractorInterface $fake) |
29
|
|
|
{ |
30
|
|
|
$this->interactor = \extension_loaded('newrelic') ? $real : $fake; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function setApplicationName(string $name, string $license = null, bool $xmit = false): bool |
34
|
|
|
{ |
35
|
|
|
return $this->interactor->setApplicationName($name, $license, $xmit); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function setTransactionName(string $name): bool |
39
|
|
|
{ |
40
|
|
|
return $this->interactor->setTransactionName($name); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function ignoreTransaction(): void |
44
|
|
|
{ |
45
|
|
|
$this->interactor->ignoreTransaction(); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function addCustomEvent(string $name, array $attributes): void |
49
|
|
|
{ |
50
|
|
|
$this->interactor->addCustomEvent($name, $attributes); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function addCustomMetric(string $name, float $value): bool |
54
|
|
|
{ |
55
|
|
|
return $this->interactor->addCustomMetric($name, $value); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function addCustomParameter(string $name, $value): bool |
59
|
|
|
{ |
60
|
|
|
return $this->interactor->addCustomParameter($name, $value); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function getBrowserTimingHeader(bool $includeTags = true): string |
64
|
|
|
{ |
65
|
|
|
return $this->interactor->getBrowserTimingHeader($includeTags); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function getBrowserTimingFooter(bool $includeTags = true): string |
69
|
|
|
{ |
70
|
|
|
return $this->interactor->getBrowserTimingFooter($includeTags); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function disableAutoRUM(): ?bool |
74
|
|
|
{ |
75
|
|
|
return $this->interactor->disableAutoRUM(); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function noticeThrowable(\Throwable $e, string $message = null): void |
79
|
|
|
{ |
80
|
|
|
$this->interactor->noticeThrowable($e, $message); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function noticeError( |
84
|
|
|
int $errno, |
85
|
|
|
string $errstr, |
86
|
|
|
string $errfile = null, |
87
|
|
|
int $errline = null, |
88
|
|
|
string $errcontext = null |
89
|
|
|
): void { |
90
|
|
|
$this->interactor->noticeError($errno, $errstr, $errfile, $errline, $errcontext); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function enableBackgroundJob(): void |
94
|
|
|
{ |
95
|
|
|
$this->interactor->enableBackgroundJob(); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function disableBackgroundJob(): void |
99
|
|
|
{ |
100
|
|
|
$this->interactor->disableBackgroundJob(); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function startTransaction(string $name = null, string $license = null): bool |
104
|
|
|
{ |
105
|
|
|
return $this->interactor->startTransaction($name, $license); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function endTransaction(bool $ignore = false): bool |
109
|
|
|
{ |
110
|
|
|
return $this->interactor->endTransaction($ignore); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function excludeFromApdex(): void |
114
|
|
|
{ |
115
|
|
|
$this->interactor->excludeFromApdex(); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
public function addCustomTracer(string $name): bool |
119
|
|
|
{ |
120
|
|
|
return $this->interactor->addCustomTracer($name); |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
public function setCaptureParams(bool $enabled): void |
124
|
|
|
{ |
125
|
|
|
$this->interactor->setCaptureParams($enabled); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
public function stopTransactionTiming(): void |
129
|
|
|
{ |
130
|
|
|
$this->interactor->stopTransactionTiming(); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
public function recordDatastoreSegment(callable $func, array $parameters) |
134
|
|
|
{ |
135
|
|
|
return $this->interactor->recordDatastoreSegment($func, $parameters); |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
public function setUserAttributes(string $userValue, string $accountValue, string $productValue): bool |
139
|
|
|
{ |
140
|
|
|
return $this->interactor->setUserAttributes($userValue, $accountValue, $productValue); |
141
|
|
|
} |
142
|
|
|
} |
143
|
|
|
|