@@ -38,15 +38,7 @@ public function addInstance(string $name, TraceableAdapter $instance): void
3838
3939 public function collect (Request $ request , Response $ response , ?\Throwable $ exception = null ): void
4040 {
41- $ empty = ['calls ' => [], 'adapters ' => [], 'config ' => [], 'options ' => [], 'statistics ' => []];
42- $ this ->data = ['instances ' => $ empty , 'total ' => $ empty ];
43- foreach ($ this ->instances as $ name => $ instance ) {
44- $ this ->data ['instances ' ]['calls ' ][$ name ] = $ instance ->getCalls ();
45- $ this ->data ['instances ' ]['adapters ' ][$ name ] = get_debug_type ($ instance ->getPool ());
46- }
47-
48- $ this ->data ['instances ' ]['statistics ' ] = $ this ->calculateStatistics ();
49- $ this ->data ['total ' ]['statistics ' ] = $ this ->calculateTotalStatistics ();
41+ $ this ->lateCollect ();
5042 }
5143
5244 public function reset (): void
@@ -59,7 +51,15 @@ public function reset(): void
5951
6052 public function lateCollect (): void
6153 {
62- $ this ->data ['instances ' ]['calls ' ] = $ this ->cloneVar ($ this ->data ['instances ' ]['calls ' ]);
54+ $ empty = ['calls ' => [], 'adapters ' => [], 'config ' => [], 'options ' => [], 'statistics ' => []];
55+ $ this ->data = ['instances ' => $ empty , 'total ' => $ empty ];
56+ foreach ($ this ->instances as $ name => $ instance ) {
57+ $ this ->data ['instances ' ]['calls ' ][$ name ] = $ instance ->getCalls ();
58+ $ this ->data ['instances ' ]['adapters ' ][$ name ] = get_debug_type ($ instance ->getPool ());
59+ }
60+
61+ $ this ->data ['instances ' ]['statistics ' ] = $ this ->calculateStatistics ();
62+ $ this ->data ['total ' ]['statistics ' ] = $ this ->calculateTotalStatistics ();
6363 }
6464
6565 public function getName (): string
0 commit comments