1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Service\NewRelic\Plugin; |
9
|
|
|
|
10
|
|
|
use Spryker\Service\Kernel\AbstractPlugin; |
11
|
|
|
use Spryker\Service\MonitoringExtension\Dependency\Plugin\MonitoringExtensionPluginInterface; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @method \SprykerEco\Service\NewRelic\NewRelicServiceInterface getService() |
15
|
|
|
*/ |
16
|
|
|
class NewRelicMonitoringExtensionPlugin extends AbstractPlugin implements MonitoringExtensionPluginInterface |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @param string $message |
20
|
|
|
* @param \Exception|\Throwable $exception |
21
|
|
|
* |
22
|
|
|
* @return void |
23
|
|
|
*/ |
24
|
|
|
public function setError(string $message, $exception): void |
25
|
|
|
{ |
26
|
|
|
$this->getConfig()-> |
27
|
|
|
$this->getService()->setError($message, $exception); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @param string|null $application |
32
|
|
|
* @param string|null $store |
33
|
|
|
* @param string|null $environment |
34
|
|
|
* |
35
|
|
|
* @return void |
36
|
|
|
*/ |
37
|
|
|
public function setApplicationName(?string $application = null, ?string $store = null, ?string $environment = null): void |
38
|
|
|
{ |
39
|
|
|
$this->getService()->setApplicationName($application, $store, $environment); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param string $name |
44
|
|
|
* |
45
|
|
|
* @return void |
46
|
|
|
*/ |
47
|
|
|
public function setTransactionName(string $name): void |
48
|
|
|
{ |
49
|
|
|
$this->getService()->setTransactionName($name); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return void |
54
|
|
|
*/ |
55
|
|
|
public function markStartTransaction(): void |
56
|
|
|
{ |
57
|
|
|
$this->getService()->markStartTransaction(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return void |
62
|
|
|
*/ |
63
|
|
|
public function markEndOfTransaction(): void |
64
|
|
|
{ |
65
|
|
|
$this->getService()->markEndOfTransaction(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return void |
70
|
|
|
*/ |
71
|
|
|
public function markIgnoreTransaction(): void |
72
|
|
|
{ |
73
|
|
|
$this->getService()->markIgnoreTransaction(); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return void |
78
|
|
|
*/ |
79
|
|
|
public function markAsConsoleCommand(): void |
80
|
|
|
{ |
81
|
|
|
$this->getService()->markAsConsoleCommand(); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param string $key |
86
|
|
|
* @param mixed $value |
87
|
|
|
* |
88
|
|
|
* @return void |
89
|
|
|
*/ |
90
|
|
|
public function addCustomParameter(string $key, $value): void |
91
|
|
|
{ |
92
|
|
|
$this->getService()->addCustomParameter($key, $value); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @param string $tracer |
97
|
|
|
* |
98
|
|
|
* @return void |
99
|
|
|
*/ |
100
|
|
|
public function addCustomTracer(string $tracer): void |
101
|
|
|
{ |
102
|
|
|
$this->getService()->addCustomTracer($tracer); |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|