1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SamuelBednarcik\ElasticAPMAgent\Events; |
4
|
|
|
|
5
|
|
|
class Transaction |
6
|
|
|
{ |
7
|
|
|
const TYPE_REQUEST = 'request'; |
8
|
|
|
const TYPE_BACKGROUND_JOB = 'backgroundjob'; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @var array|null |
12
|
|
|
*/ |
13
|
|
|
protected $context; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @var float|null |
17
|
|
|
*/ |
18
|
|
|
protected $duration; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var string|null |
22
|
|
|
*/ |
23
|
|
|
protected $name; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var string|null |
27
|
|
|
*/ |
28
|
|
|
protected $result; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var string|null |
32
|
|
|
*/ |
33
|
|
|
protected $type; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var bool|null |
37
|
|
|
*/ |
38
|
|
|
protected $sampled; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var string|null |
42
|
|
|
*/ |
43
|
|
|
protected $id; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var string|null |
47
|
|
|
*/ |
48
|
|
|
protected $traceId; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var string|null |
52
|
|
|
*/ |
53
|
|
|
protected $parentId; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var array|null |
57
|
|
|
*/ |
58
|
|
|
protected $spanCount; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var array|null |
62
|
|
|
*/ |
63
|
|
|
protected $marks; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var int|null |
67
|
|
|
*/ |
68
|
|
|
protected $timestamp; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return array|null |
72
|
|
|
*/ |
73
|
|
|
public function getContext(): ?array |
74
|
|
|
{ |
75
|
|
|
return $this->context; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param array|null $context |
80
|
|
|
*/ |
81
|
|
|
public function setContext(?array $context): void |
82
|
|
|
{ |
83
|
|
|
$this->context = $context; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @return float|null |
88
|
|
|
*/ |
89
|
|
|
public function getDuration(): ?float |
90
|
|
|
{ |
91
|
|
|
return $this->duration; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @param float|null $duration |
96
|
|
|
*/ |
97
|
|
|
public function setDuration(?float $duration): void |
98
|
|
|
{ |
99
|
|
|
$this->duration = $duration; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return null|string |
104
|
|
|
*/ |
105
|
|
|
public function getName(): ?string |
106
|
|
|
{ |
107
|
|
|
return $this->name; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @param null|string $name |
112
|
|
|
*/ |
113
|
|
|
public function setName(?string $name): void |
114
|
|
|
{ |
115
|
|
|
$this->name = $name; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return null|string |
120
|
|
|
*/ |
121
|
|
|
public function getResult(): ?string |
122
|
|
|
{ |
123
|
|
|
return $this->result; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param null|string $result |
128
|
|
|
*/ |
129
|
|
|
public function setResult(?string $result): void |
130
|
|
|
{ |
131
|
|
|
$this->result = $result; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return null|string |
136
|
|
|
*/ |
137
|
|
|
public function getType(): ?string |
138
|
|
|
{ |
139
|
|
|
return $this->type; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @param null|string $type |
144
|
|
|
*/ |
145
|
|
|
public function setType(?string $type): void |
146
|
|
|
{ |
147
|
|
|
$this->type = $type; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @return bool|null |
152
|
|
|
*/ |
153
|
|
|
public function getSampled(): ?bool |
154
|
|
|
{ |
155
|
|
|
return $this->sampled; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @param bool|null $sampled |
160
|
|
|
*/ |
161
|
|
|
public function setSampled(?bool $sampled): void |
162
|
|
|
{ |
163
|
|
|
$this->sampled = $sampled; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @return null|string |
168
|
|
|
*/ |
169
|
|
|
public function getId(): ?string |
170
|
|
|
{ |
171
|
|
|
return $this->id; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @param null|string $id |
176
|
|
|
*/ |
177
|
|
|
public function setId(?string $id): void |
178
|
|
|
{ |
179
|
|
|
$this->id = $id; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @return null|string |
184
|
|
|
*/ |
185
|
|
|
public function getTraceId(): ?string |
186
|
|
|
{ |
187
|
|
|
return $this->traceId; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @param null|string $traceId |
192
|
|
|
*/ |
193
|
|
|
public function setTraceId(?string $traceId): void |
194
|
|
|
{ |
195
|
|
|
$this->traceId = $traceId; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* @return null|string |
200
|
|
|
*/ |
201
|
|
|
public function getParentId(): ?string |
202
|
|
|
{ |
203
|
|
|
return $this->parentId; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* @param null|string $parentId |
208
|
|
|
*/ |
209
|
|
|
public function setParentId(?string $parentId): void |
210
|
|
|
{ |
211
|
|
|
$this->parentId = $parentId; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* @return array|null |
216
|
|
|
*/ |
217
|
|
|
public function getSpanCount(): ?array |
218
|
|
|
{ |
219
|
|
|
return $this->spanCount; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* @param array|null $spanCount |
224
|
|
|
*/ |
225
|
|
|
public function setSpanCount(?array $spanCount): void |
226
|
|
|
{ |
227
|
|
|
$this->spanCount = $spanCount; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* @return array|null |
232
|
|
|
*/ |
233
|
|
|
public function getMarks(): ?array |
234
|
|
|
{ |
235
|
|
|
return $this->marks; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* @param array|null $marks |
240
|
|
|
*/ |
241
|
|
|
public function setMarks(?array $marks): void |
242
|
|
|
{ |
243
|
|
|
$this->marks = $marks; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* @return int|null |
248
|
|
|
*/ |
249
|
|
|
public function getTimestamp(): ?int |
250
|
|
|
{ |
251
|
|
|
return $this->timestamp; |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* @param int|null $timestamp |
256
|
|
|
*/ |
257
|
|
|
public function setTimestamp(?int $timestamp): void |
258
|
|
|
{ |
259
|
|
|
$this->timestamp = $timestamp; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
} |
263
|
|
|
|