1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SamuelBednarcik\ElasticAPMAgent\Events; |
4
|
|
|
|
5
|
|
|
class Span |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* Hex encoded 64 random bits ID of the span |
9
|
|
|
* @var string|null |
10
|
|
|
*/ |
11
|
|
|
protected $id; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Hex encoded 64 random bits ID of the correlated transaction |
15
|
|
|
* @var string|null |
16
|
|
|
*/ |
17
|
|
|
protected $transactionId; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Hex encoded 128 random bits ID of the correlated trace |
21
|
|
|
* @var string|null |
22
|
|
|
*/ |
23
|
|
|
protected $traceId; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Hex encoded 64 random bits ID of the parent transaction or span |
27
|
|
|
* @var string|null |
28
|
|
|
*/ |
29
|
|
|
protected $parentId; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Offset relative to the transaction's timestamp identifying the start of the span, in milliseconds |
33
|
|
|
* @var int|null |
34
|
|
|
*/ |
35
|
|
|
protected $start; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Timestamp of the start of span in microseconds |
39
|
|
|
* @var int|null |
40
|
|
|
*/ |
41
|
|
|
protected $timestamp; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Duration of the span in milliseconds |
45
|
|
|
* @var float|null |
46
|
|
|
*/ |
47
|
|
|
protected $duration; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Generic designation of a span in the scope of a transaction |
51
|
|
|
* @var string|null |
52
|
|
|
*/ |
53
|
|
|
protected $name; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Keyword of specific relevance in the service's domain (eg: 'db.postgresql.query', 'template.erb', etc) |
57
|
|
|
* @var string|null |
58
|
|
|
*/ |
59
|
|
|
protected $type; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Any other arbitrary data |
63
|
|
|
* @var array|null |
64
|
|
|
*/ |
65
|
|
|
protected $context; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return null|string |
69
|
|
|
*/ |
70
|
|
|
public function getId(): ?string |
71
|
|
|
{ |
72
|
|
|
return $this->id; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param null|string $id |
77
|
|
|
*/ |
78
|
|
|
public function setId(?string $id): void |
79
|
|
|
{ |
80
|
|
|
$this->id = $id; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return null|string |
85
|
|
|
*/ |
86
|
|
|
public function getTransactionId(): ?string |
87
|
|
|
{ |
88
|
|
|
return $this->transactionId; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @param null|string $transactionId |
93
|
|
|
*/ |
94
|
|
|
public function setTransactionId(?string $transactionId): void |
95
|
|
|
{ |
96
|
|
|
$this->transactionId = $transactionId; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return null|string |
101
|
|
|
*/ |
102
|
|
|
public function getTraceId(): ?string |
103
|
|
|
{ |
104
|
|
|
return $this->traceId; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @param null|string $traceId |
109
|
|
|
*/ |
110
|
|
|
public function setTraceId(?string $traceId): void |
111
|
|
|
{ |
112
|
|
|
$this->traceId = $traceId; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return null|string |
117
|
|
|
*/ |
118
|
|
|
public function getParentId(): ?string |
119
|
|
|
{ |
120
|
|
|
return $this->parentId; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @param null|string $parentId |
125
|
|
|
*/ |
126
|
|
|
public function setParentId(?string $parentId): void |
127
|
|
|
{ |
128
|
|
|
$this->parentId = $parentId; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @return int|null |
133
|
|
|
*/ |
134
|
|
|
public function getStart(): ?int |
135
|
|
|
{ |
136
|
|
|
return $this->start; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @param null|int $start |
141
|
|
|
*/ |
142
|
|
|
public function setStart(?int $start): void |
143
|
|
|
{ |
144
|
|
|
$this->start = $start; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return int|null |
149
|
|
|
*/ |
150
|
|
|
public function getTimestamp(): ?int |
151
|
|
|
{ |
152
|
|
|
return $this->timestamp; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @param int|null $timestamp |
157
|
|
|
*/ |
158
|
|
|
public function setTimestamp(?int $timestamp): void |
159
|
|
|
{ |
160
|
|
|
$this->timestamp = $timestamp; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return float|null |
165
|
|
|
*/ |
166
|
|
|
public function getDuration(): ?float |
167
|
|
|
{ |
168
|
|
|
return $this->duration; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @param float|null $duration |
173
|
|
|
*/ |
174
|
|
|
public function setDuration(?float $duration): void |
175
|
|
|
{ |
176
|
|
|
$this->duration = $duration; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @return null|string |
181
|
|
|
*/ |
182
|
|
|
public function getName(): ?string |
183
|
|
|
{ |
184
|
|
|
return $this->name; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @param null|string $name |
189
|
|
|
*/ |
190
|
|
|
public function setName(?string $name): void |
191
|
|
|
{ |
192
|
|
|
$this->name = $name; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @return null|string |
197
|
|
|
*/ |
198
|
|
|
public function getType(): ?string |
199
|
|
|
{ |
200
|
|
|
return $this->type; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @param null|string $type |
205
|
|
|
*/ |
206
|
|
|
public function setType(?string $type): void |
207
|
|
|
{ |
208
|
|
|
$this->type = $type; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @return array|null |
213
|
|
|
*/ |
214
|
|
|
public function getContext(): ?array |
215
|
|
|
{ |
216
|
|
|
return $this->context; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @param array|null $context |
221
|
|
|
*/ |
222
|
|
|
public function setContext(?array $context): void |
223
|
|
|
{ |
224
|
|
|
$this->context = $context; |
225
|
|
|
} |
226
|
|
|
} |
227
|
|
|
|