File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 1
1
<?php declare (strict_types=1 );
2
2
3
+ use function EventLoop \getLoop ;
4
+ use React \EventLoop \LoopInterface ;
3
5
use ReactInspector \EventLoop \LoopCollector ;
4
6
use ReactInspector \MemoryUsage \MemoryUsageCollector ;
5
7
use ReactInspector \Metrics ;
6
8
use ReactInspector \MetricsStreamInterface ;
7
9
use ReactInspector \Stream \IOCollector ;
8
- use function EventLoop \getLoop ;
9
- use React \EventLoop \LoopInterface ;
10
10
11
11
return [
12
12
LoopInterface::class => function () {
13
13
return getLoop ();
14
14
},
15
- MetricsStreamInterface::class => function (LoopInterface $ loop ) {
15
+ MetricsStreamInterface::class => function (LoopInterface $ loop, AdditionalCollectors $ additionalCollectors ) {
16
16
return new Metrics (
17
17
$ loop ,
18
18
1 ,
19
19
new LoopCollector ($ loop ),
20
20
new MemoryUsageCollector ($ loop ),
21
- new IOCollector ()
21
+ new IOCollector (),
22
+ ...$ additionalCollectors ->get ()
22
23
);
23
24
},
24
25
];
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use ReactInspector \CollectorInterface ;
4
+
5
+ final class AdditionalCollectors
6
+ {
7
+ private $ collectors = [];
8
+
9
+ public function add (CollectorInterface $ collector ): void
10
+ {
11
+ $ this ->collectors [] = $ collector ;
12
+ }
13
+
14
+ public function get (): array
15
+ {
16
+ return $ this ->collectors ;
17
+ }
18
+ }
19
+
You can’t perform that action at this time.
0 commit comments