|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SamuelBednarcik\ElasticAPMAgent\Events; |
|
4
|
|
|
|
|
5
|
|
|
class Error |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* Hex encoded 128 random bits ID of the error. |
|
9
|
|
|
* @var string|null |
|
10
|
|
|
*/ |
|
11
|
|
|
protected $id; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Hex encoded 128 random bits ID of the correlated trace. |
|
15
|
|
|
* Must be present if transaction_id and parent_id are set. |
|
16
|
|
|
* @var string|null |
|
17
|
|
|
*/ |
|
18
|
|
|
protected $traceId; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Hex encoded 64 random bits ID of the correlated transaction. |
|
22
|
|
|
* Must be present if trace_id and parent_id are set. |
|
23
|
|
|
* @var string|null |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $transactionId; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Hex encoded 64 random bits ID of the parent transaction or span. |
|
29
|
|
|
* Must be present if trace_id and transaction_id are set. |
|
30
|
|
|
* @var string|null |
|
31
|
|
|
*/ |
|
32
|
|
|
protected $parentId; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var array|null |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $context; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Function call which was the primary perpetrator of this event. |
|
41
|
|
|
* @var string|null |
|
42
|
|
|
*/ |
|
43
|
|
|
protected $culprit; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Information about the originally thrown error. |
|
47
|
|
|
* @var ErrorException|null |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $exception; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Additional information added when logging the error. |
|
53
|
|
|
* @var array|null |
|
54
|
|
|
*/ |
|
55
|
|
|
protected $log; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Timestamp in microseconds. |
|
59
|
|
|
* @var int|null |
|
60
|
|
|
*/ |
|
61
|
|
|
protected $timestamp; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @return null|string |
|
65
|
|
|
*/ |
|
66
|
|
|
public function getId(): ?string |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->id; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @param null|string $id |
|
73
|
|
|
*/ |
|
74
|
|
|
public function setId(?string $id): void |
|
75
|
|
|
{ |
|
76
|
|
|
$this->id = $id; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @return null|string |
|
81
|
|
|
*/ |
|
82
|
|
|
public function getTraceId(): ?string |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->traceId; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* @param null|string $traceId |
|
89
|
|
|
*/ |
|
90
|
|
|
public function setTraceId(?string $traceId): void |
|
91
|
|
|
{ |
|
92
|
|
|
$this->traceId = $traceId; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* @return null|string |
|
97
|
|
|
*/ |
|
98
|
|
|
public function getTransactionId(): ?string |
|
99
|
|
|
{ |
|
100
|
|
|
return $this->transactionId; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* @param null|string $transactionId |
|
105
|
|
|
*/ |
|
106
|
|
|
public function setTransactionId(?string $transactionId): void |
|
107
|
|
|
{ |
|
108
|
|
|
$this->transactionId = $transactionId; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @return null|string |
|
113
|
|
|
*/ |
|
114
|
|
|
public function getParentId(): ?string |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->parentId; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* @param null|string $parentId |
|
121
|
|
|
*/ |
|
122
|
|
|
public function setParentId(?string $parentId): void |
|
123
|
|
|
{ |
|
124
|
|
|
$this->parentId = $parentId; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* @return null|string |
|
129
|
|
|
*/ |
|
130
|
|
|
public function getCulprit(): ?string |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->culprit; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* @param null|string $culprit |
|
137
|
|
|
*/ |
|
138
|
|
|
public function setCulprit(?string $culprit): void |
|
139
|
|
|
{ |
|
140
|
|
|
$this->culprit = $culprit; |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* @return array|null |
|
145
|
|
|
*/ |
|
146
|
|
|
public function getContext(): ?array |
|
147
|
|
|
{ |
|
148
|
|
|
return $this->context; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* @param array|null $context |
|
153
|
|
|
*/ |
|
154
|
|
|
public function setContext(?array $context): void |
|
155
|
|
|
{ |
|
156
|
|
|
$this->context = $context; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* @return ErrorException|null |
|
161
|
|
|
*/ |
|
162
|
|
|
public function getException(): ?ErrorException |
|
163
|
|
|
{ |
|
164
|
|
|
return $this->exception; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* @param ErrorException|null $exception |
|
169
|
|
|
*/ |
|
170
|
|
|
public function setException(?ErrorException $exception): void |
|
171
|
|
|
{ |
|
172
|
|
|
$this->exception = $exception; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* @return array|null |
|
177
|
|
|
*/ |
|
178
|
|
|
public function getLog(): ?array |
|
179
|
|
|
{ |
|
180
|
|
|
return $this->log; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* @param array|null $log |
|
185
|
|
|
*/ |
|
186
|
|
|
public function setLog(?array $log): void |
|
187
|
|
|
{ |
|
188
|
|
|
$this->log = $log; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
/** |
|
192
|
|
|
* @return int|null |
|
193
|
|
|
*/ |
|
194
|
|
|
public function getTimestamp(): ?int |
|
195
|
|
|
{ |
|
196
|
|
|
return $this->timestamp; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* @param int|null $timestamp |
|
201
|
|
|
*/ |
|
202
|
|
|
public function setTimestamp(?int $timestamp): void |
|
203
|
|
|
{ |
|
204
|
|
|
$this->timestamp = $timestamp; |
|
205
|
|
|
} |
|
206
|
|
|
} |
|
207
|
|
|
|