1616
1717use Doctrine \ORM \EntityManagerInterface ;
1818use Flowpack \Neos \Debug \DataCollector \CacheAccessCollector ;
19+ use Flowpack \Neos \Debug \DataCollector \ContentContextMetricsCollectorInterface ;
1920use Flowpack \Neos \Debug \DataCollector \MessagesCollector ;
2021use Flowpack \Neos \Debug \Domain \Model \Dto \ResourceStreamRequest ;
2122use Flowpack \Neos \Debug \Logging \DebugStack ;
2223use Flowpack \Neos \Debug \Service \DebugService ;
2324use GuzzleHttp \Psr7 \Response ;
2425use GuzzleHttp \Psr7 \Utils ;
25- use Neos \ContentRepository \Domain \Service \ContextFactoryInterface ;
2626use Neos \Flow \Annotations as Flow ;
2727use Neos \Flow \Aop \JoinPointInterface ;
2828use Neos \Flow \ResourceManagement \PersistentResource ;
@@ -41,9 +41,6 @@ class CollectDebugInformationAspect
4141
4242 protected DebugStack $ sqlLoggingStack ;
4343
44- #[Flow \Inject]
45- protected ContextFactoryInterface $ contextFactory ;
46-
4744 protected int $ contentCacheHits = 0 ;
4845
4946 /**
@@ -67,6 +64,9 @@ class CollectDebugInformationAspect
6764 #[Flow \Inject]
6865 protected CacheAccessCollector $ cacheAccessCollector ;
6966
67+ #[Flow \Inject()]
68+ protected ContentContextMetricsCollectorInterface $ contentContextMetricsCollector ;
69+
7070 #[Flow \Pointcut("setting(Flowpack.Neos.Debug.enabled) " )]
7171 public function debuggingActive (): void
7272 {
@@ -120,24 +120,6 @@ protected function addDebugValues(JoinPointInterface $joinPoint): string|Respons
120120
121121 $ groupedQueries = $ this ->groupQueries ($ this ->sqlLoggingStack ->queries );
122122
123- // Analyse ContentContext
124- $ contentContextMetrics = [];
125- foreach ($ this ->contextFactory ->getInstances () as $ contextIdentifier => $ context ) {
126- $ firstLevelNodeCache = $ context ->getFirstLevelNodeCache ();
127- $ contentContextMetrics [$ contextIdentifier ] = [
128- 'workspace ' => $ context ->getWorkspace ()->getName (),
129- 'dimensions ' => $ context ->getDimensions (),
130- 'invisibleContentShown ' => $ context ->isInvisibleContentShown (),
131- 'removedContentShown ' => $ context ->isRemovedContentShown (),
132- 'inaccessibleContentShown ' => $ context ->isInaccessibleContentShown (),
133- 'firstLevelNodeCache ' => [
134- 'nodesByPath ' => count (ObjectAccess::getProperty ($ firstLevelNodeCache , 'nodesByPath ' , true )),
135- 'nodesByIdentifier ' => count (ObjectAccess::getProperty ($ firstLevelNodeCache , 'nodesByIdentifier ' , true )),
136- 'childNodesByPathAndNodeTypeFilter ' => count (ObjectAccess::getProperty ($ firstLevelNodeCache , 'childNodesByPathAndNodeTypeFilter ' , true )),
137- ],
138- ];
139- }
140-
141123 // TODO: Introduce DTOs for the data
142124 $ data = [
143125 'startRenderAt ' => $ startRenderAt ,
@@ -160,7 +142,7 @@ protected function addDebugValues(JoinPointInterface $joinPoint): string|Respons
160142 // TODO: Iterate over all existing collectors
161143 $ this ->messagesCollector ->getName () => $ this ->messagesCollector ->collect (),
162144 $ this ->cacheAccessCollector ->getName () => $ this ->cacheAccessCollector ->collect (),
163- ' contentContextMetrics ' => $ contentContextMetrics ,
145+ $ this -> contentContextMetricsCollector -> getName () => $ this -> contentContextMetricsCollector -> collect () ,
164146 ]
165147 ];
166148
0 commit comments