Skip to content

Commit 75bba5b

Browse files
authored
Merge pull request #155 from nextcloud/feat/fs-event-stats
fix: Add Fs events to stats
2 parents 9fc49a2 + a22c2c3 commit 75bba5b

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

lib/Command/Statistics.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace OCA\ContextChat\Command;
1111

12+
use OCA\ContextChat\Db\FsEventMapper;
1213
use OCA\ContextChat\Db\QueueContentItemMapper;
1314
use OCA\ContextChat\Service\ActionScheduler;
1415
use OCA\ContextChat\Service\LangRopeService;
@@ -29,6 +30,7 @@ public function __construct(
2930
private StorageService $storageService,
3031
private LangRopeService $langRopeService,
3132
private QueueContentItemMapper $contentQueue,
33+
private FsEventMapper $fsEventMapper,
3234
) {
3335
parent::__construct();
3436
}
@@ -69,6 +71,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6971

7072
$actionsCount = $this->actionService->count();
7173
$output->writeln('Actions in queue: ' . $actionsCount);
74+
75+
$fsEventsCount = $this->fsEventMapper->count();
76+
$output->writeln('File system events in queue: ' . $fsEventsCount);
7277
return 0;
7378
}
7479
}

lib/Settings/AdminSettings.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
namespace OCA\ContextChat\Settings;
88

9+
use OCA\ContextChat\Db\FsEventMapper;
910
use OCA\ContextChat\Db\QueueContentItemMapper;
1011
use OCA\ContextChat\Logger;
1112
use OCA\ContextChat\Service\ActionScheduler;
@@ -30,6 +31,7 @@ public function __construct(
3031
private LangRopeService $langRopeService,
3132
private QueueContentItemMapper $contentQueue,
3233
private Logger $logger,
34+
private FsEventMapper $fsEventMapper,
3335
) {
3436
}
3537

@@ -60,6 +62,12 @@ public function getForm(): TemplateResponse {
6062
$this->logger->error($e->getMessage(), ['exception' => $e]);
6163
$stats['queued_actions_count'] = 0;
6264
}
65+
try {
66+
$stats['queued_fs_events_count'] = $this->fsEventMapper->count();
67+
} catch (Exception $e) {
68+
$this->logger->error($e->getMessage(), ['exception' => $e]);
69+
$stats['queued_fs_events_count'] = 0;
70+
}
6371
try {
6472
$stats['vectordb_document_counts'] = $this->langRopeService->getIndexedDocumentsCounts();
6573
$stats['backend_available'] = true;

src/components/ViewAdmin.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
4646
<p>&nbsp;</p>
4747
<p>{{ t('context_chat', 'Eligible files for indexing: {count}', {count: stats.eligible_files_count}) }}</p>
4848
<p>{{ t('context_chat', 'Queued content update actions: {count}', {count: stats.queued_actions_count}) }}</p>
49+
<p>{{ t('context_chat', 'Queued File System events: {count}', {count: stats.queued_fs_events_count}) }}</p>
4950
</NcSettingsSection>
5051
<NcSettingsSection :name="t('context_chat', 'Context Chat Logs')">
5152
<div class="horizontal-flex">

0 commit comments

Comments
 (0)