1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
namespace ZERO2TEN\Observability\APM\Agent; |
4
|
|
|
|
5
|
|
|
use Throwable; |
6
|
|
|
use ZERO2TEN\Observability\APM\Datastore; |
7
|
|
|
use ZERO2TEN\Observability\APM\TransactionInterface; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* NullAgent |
11
|
|
|
* |
12
|
|
|
* @copyright Copyright (c) 2023 0TO10 B.V. <https://0to10.nl> |
13
|
|
|
* @package ZERO2TEN\Observability\APM\Agent |
14
|
|
|
*/ |
15
|
|
|
final class NullAgent extends Agent |
16
|
|
|
{ |
17
|
|
|
/** @var bool */ |
18
|
|
|
private $transactionEnded = false; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @inheritDoc |
22
|
|
|
*/ |
23
|
1 |
|
protected function initialise(): bool |
24
|
|
|
{ |
25
|
1 |
|
return true; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @inheritdoc |
30
|
|
|
*/ |
31
|
1 |
|
public function changeApplicationName(string $name, bool $ignoreTransaction = true): void |
32
|
|
|
{ |
33
|
1 |
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @inheritDoc |
37
|
|
|
*/ |
38
|
1 |
|
public function captureUrlParameters(bool $enable = true): void |
39
|
|
|
{ |
40
|
1 |
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @inheritdoc |
44
|
|
|
*/ |
45
|
1 |
|
public function recordCustomEvent(string $name, array $attributes): void |
46
|
|
|
{ |
47
|
1 |
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @inheritdoc |
51
|
|
|
*/ |
52
|
1 |
|
public function addCustomMetric(string $name, float $milliseconds): void |
53
|
|
|
{ |
54
|
1 |
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @inheritdoc |
58
|
|
|
*/ |
59
|
1 |
|
public function disableAutomaticBrowserMonitoringScripts(): void |
60
|
|
|
{ |
61
|
1 |
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @inheritdoc |
65
|
|
|
*/ |
66
|
1 |
|
public function getBrowserMonitoringHeaderScript(): string |
67
|
|
|
{ |
68
|
1 |
|
return '<!-- NullAgent - header.js -->'; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @inheritdoc |
73
|
|
|
*/ |
74
|
1 |
|
public function getBrowserMonitoringFooterScript(): string |
75
|
|
|
{ |
76
|
1 |
|
return '<!-- NullAgent - footer.js -->'; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @inheritdoc |
81
|
|
|
*/ |
82
|
2 |
|
public function startTransaction(bool $ignorePrevious = false): TransactionInterface |
83
|
|
|
{ |
84
|
2 |
|
$this->transactionEnded = false; |
85
|
|
|
|
86
|
2 |
|
return $this->createTransaction($this); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @inheritdoc |
91
|
|
|
*/ |
92
|
1 |
|
public function changeTransactionName(string $name): void |
93
|
|
|
{ |
94
|
1 |
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @inheritdoc |
98
|
|
|
*/ |
99
|
1 |
|
public function addTransactionParameter(string $name, $value): void |
100
|
|
|
{ |
101
|
1 |
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @inheritdoc |
105
|
|
|
*/ |
106
|
2 |
|
public function markTransactionAsBackground(bool $background): void |
107
|
|
|
{ |
108
|
2 |
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @inheritdoc |
112
|
|
|
*/ |
113
|
1 |
|
public function recordTransactionException(string $message, Throwable $e): void |
114
|
|
|
{ |
115
|
1 |
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @inheritDoc |
119
|
|
|
*/ |
120
|
1 |
|
public function addTransactionDatastoreSegment( |
121
|
|
|
Datastore $datastore, |
122
|
|
|
callable $callable, |
123
|
|
|
string $query = null, |
124
|
|
|
string $inputQueryLabel = null, |
125
|
|
|
string $inputQuery = null |
126
|
|
|
) |
127
|
|
|
{ |
128
|
1 |
|
return null; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @inheritdoc |
133
|
|
|
*/ |
134
|
1 |
|
public function stopTransactionTiming(): void |
135
|
|
|
{ |
136
|
1 |
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @inheritdoc |
140
|
|
|
*/ |
141
|
1 |
|
public function ignoreTransactionApdex(): void |
142
|
|
|
{ |
143
|
1 |
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @inheritdoc |
147
|
|
|
*/ |
148
|
1 |
|
public function ignoreTransaction(): void |
149
|
|
|
{ |
150
|
1 |
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @inheritDoc |
154
|
|
|
*/ |
155
|
1 |
|
public function isTransactionSampled(): bool |
156
|
|
|
{ |
157
|
1 |
|
return true; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @inheritdoc |
162
|
|
|
*/ |
163
|
1 |
|
public function endTransaction(): void |
164
|
|
|
{ |
165
|
1 |
|
$this->transactionEnded = true; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @inheritDoc |
170
|
|
|
*/ |
171
|
1 |
|
public function isTransactionEnded(): bool |
172
|
|
|
{ |
173
|
1 |
|
return $this->transactionEnded; |
174
|
|
|
} |
175
|
|
|
} |
176
|
|
|
|