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->getService()->setError($message, $exception); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param string|null $application |
31
|
|
|
* @param string|null $store |
32
|
|
|
* @param string|null $environment |
33
|
|
|
* |
34
|
|
|
* @return void |
35
|
|
|
*/ |
36
|
|
|
public function setApplicationName(?string $application = null, ?string $store = null, ?string $environment = null): void |
37
|
|
|
{ |
38
|
|
|
$this->getService()->setApplicationName($application, $store, $environment); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param string $name |
43
|
|
|
* |
44
|
|
|
* @return void |
45
|
|
|
*/ |
46
|
|
|
public function setTransactionName(string $name): void |
47
|
|
|
{ |
48
|
|
|
$this->getService()->setTransactionName($name); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return void |
53
|
|
|
*/ |
54
|
|
|
public function markStartTransaction(): void |
55
|
|
|
{ |
56
|
|
|
$this->getService()->markStartTransaction(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return void |
61
|
|
|
*/ |
62
|
|
|
public function markEndOfTransaction(): void |
63
|
|
|
{ |
64
|
|
|
$this->getService()->markEndOfTransaction(); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return void |
69
|
|
|
*/ |
70
|
|
|
public function markIgnoreTransaction(): void |
71
|
|
|
{ |
72
|
|
|
$this->getService()->markIgnoreTransaction(); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return void |
77
|
|
|
*/ |
78
|
|
|
public function markAsConsoleCommand(): void |
79
|
|
|
{ |
80
|
|
|
$this->getService()->markAsConsoleCommand(); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param string $key |
85
|
|
|
* @param mixed $value |
86
|
|
|
* |
87
|
|
|
* @return void |
88
|
|
|
*/ |
89
|
|
|
public function addCustomParameter(string $key, $value): void |
90
|
|
|
{ |
91
|
|
|
$this->getService()->addCustomParameter($key, $value); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @param string $tracer |
96
|
|
|
* |
97
|
|
|
* @return void |
98
|
|
|
*/ |
99
|
|
|
public function addCustomTracer(string $tracer): void |
100
|
|
|
{ |
101
|
|
|
$this->getService()->addCustomTracer($tracer); |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|