4
4
5
5
namespace Enqueue \Monitoring ;
6
6
7
- class ConsumerStats extends Event
7
+ class ConsumerStats implements Stats
8
8
{
9
9
/**
10
- * @var string[]
10
+ * @var string
11
11
*/
12
- protected $ queues ;
12
+ protected $ consumerId ;
13
+
14
+ /**
15
+ * @var int
16
+ */
17
+ protected $ timestampMs ;
13
18
14
19
/**
15
20
* @var int
16
21
*/
17
22
protected $ startedAtMs ;
18
23
24
+ /**
25
+ * @var int
26
+ */
27
+ protected $ finishedAtMs ;
28
+
29
+ /**
30
+ * @var bool
31
+ */
32
+ protected $ started ;
33
+
34
+ /**
35
+ * @var bool
36
+ */
37
+ protected $ finished ;
38
+
39
+ /**
40
+ * @var bool
41
+ */
42
+ protected $ failed ;
43
+
44
+ /**
45
+ * @var string[]
46
+ */
47
+ protected $ queues ;
48
+
19
49
/**
20
50
* @var int
21
51
*/
@@ -46,19 +76,66 @@ class ConsumerStats extends Event
46
76
*/
47
77
protected $ systemLoad ;
48
78
79
+ /**
80
+ * @var string
81
+ */
82
+ protected $ errorClass ;
83
+
84
+ /**
85
+ * @var string
86
+ */
87
+ protected $ errorMessage ;
88
+
89
+ /**
90
+ * @var int
91
+ */
92
+ protected $ errorCode ;
93
+
94
+ /**
95
+ * @var string
96
+ */
97
+ protected $ errorFile ;
98
+
99
+ /**
100
+ * @var int
101
+ */
102
+ protected $ errorLine ;
103
+
104
+ /**
105
+ * @var string
106
+ */
107
+ protected $ trance ;
108
+
49
109
public function __construct (
50
110
string $ consumerId ,
51
111
int $ timestampMs ,
52
- array $ queues ,
53
112
int $ startedAtMs ,
113
+ ?int $ finishedAtMs ,
114
+ bool $ started ,
115
+ bool $ finished ,
116
+ bool $ failed ,
117
+ array $ queues ,
54
118
int $ received ,
55
119
int $ acknowledged ,
56
120
int $ rejected ,
57
121
int $ requeued ,
58
122
int $ memoryUsage ,
59
- float $ systemLoad
123
+ float $ systemLoad ,
124
+ string $ errorClass = null ,
125
+ string $ errorMessage = null ,
126
+ int $ errorCode = null ,
127
+ string $ errorFile = null ,
128
+ int $ errorLine = null ,
129
+ string $ trace = null
60
130
) {
61
- parent ::__construct ($ consumerId , $ timestampMs );
131
+ $ this ->consumerId = $ consumerId ;
132
+ $ this ->timestampMs = $ timestampMs ;
133
+ $ this ->startedAtMs = $ startedAtMs ;
134
+ $ this ->finishedAtMs = $ finishedAtMs ;
135
+
136
+ $ this ->started = $ started ;
137
+ $ this ->finished = $ finished ;
138
+ $ this ->failed = $ failed ;
62
139
63
140
$ this ->queues = $ queues ;
64
141
$ this ->startedAtMs = $ startedAtMs ;
@@ -69,18 +146,55 @@ public function __construct(
69
146
70
147
$ this ->memoryUsage = $ memoryUsage ;
71
148
$ this ->systemLoad = $ systemLoad ;
149
+
150
+ $ this ->errorClass = $ errorClass ;
151
+ $ this ->errorMessage = $ errorMessage ;
152
+ $ this ->errorCode = $ errorCode ;
153
+ $ this ->errorFile = $ errorFile ;
154
+ $ this ->errorLine = $ errorLine ;
155
+ $ this ->trance = $ trace ;
72
156
}
73
157
74
- public function getQueues (): array
158
+ public function getConsumerId (): string
75
159
{
76
- return $ this ->queues ;
160
+ return $ this ->consumerId ;
161
+ }
162
+
163
+ public function getTimestampMs (): int
164
+ {
165
+ return $ this ->timestampMs ;
77
166
}
78
167
79
168
public function getStartedAtMs (): int
80
169
{
81
170
return $ this ->startedAtMs ;
82
171
}
83
172
173
+ public function getFinishedAtMs (): ?int
174
+ {
175
+ return $ this ->finishedAtMs ;
176
+ }
177
+
178
+ public function isStarted (): bool
179
+ {
180
+ return $ this ->started ;
181
+ }
182
+
183
+ public function isFinished (): bool
184
+ {
185
+ return $ this ->finished ;
186
+ }
187
+
188
+ public function isFailed (): bool
189
+ {
190
+ return $ this ->failed ;
191
+ }
192
+
193
+ public function getQueues (): array
194
+ {
195
+ return $ this ->queues ;
196
+ }
197
+
84
198
public function getReceived (): int
85
199
{
86
200
return $ this ->received ;
@@ -110,4 +224,34 @@ public function getSystemLoad(): float
110
224
{
111
225
return $ this ->systemLoad ;
112
226
}
227
+
228
+ public function getErrorClass (): ?string
229
+ {
230
+ return $ this ->errorClass ;
231
+ }
232
+
233
+ public function getErrorMessage (): ?string
234
+ {
235
+ return $ this ->errorMessage ;
236
+ }
237
+
238
+ public function getErrorCode (): ?int
239
+ {
240
+ return $ this ->errorCode ;
241
+ }
242
+
243
+ public function getErrorFile (): ?string
244
+ {
245
+ return $ this ->errorFile ;
246
+ }
247
+
248
+ public function getErrorLine (): ?int
249
+ {
250
+ return $ this ->errorLine ;
251
+ }
252
+
253
+ public function getTrance (): ?string
254
+ {
255
+ return $ this ->trance ;
256
+ }
113
257
}
0 commit comments