Skip to content

Commit

Permalink
more queues stats
Browse files Browse the repository at this point in the history
hamed-aloware committed Jun 20, 2022
1 parent 06531ee commit d075c3e
Showing 3 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion public/app.js

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions resources/js/screens/queues/index.vue
Original file line number Diff line number Diff line change
@@ -138,9 +138,11 @@
<table v-if="ready && queues.length > 0" class="table table-hover table-sm mb-0">
<thead>
<tr>
<th>Queue Name</th>
<th>Queue Partitions</th>
<th>Number of Jobs</th>
<th>Queue</th>
<th>Partitions</th>
<th>Jobs</th>
<th>Processed 1 Minute</th>
<th>Processed 20 Minute</th>
<th></th>
</tr>
</thead>
@@ -154,6 +156,8 @@
</td>
<td>{{ queue.partitions_count }}</td>
<td>{{ queue.jobs_count }}</td>
<td>{{ queue.processed_jobs_count_1_min }}</td>
<td>{{ queue.processed_jobs_count_20_min }}</td>
<td class="gen-btn">
<button @click="showFakeSignalModal(queue.queue)" class="btn btn-primary btn-sm">Fake Signal Gen</button>
</td>
18 changes: 17 additions & 1 deletion src/Repositories/RedisRepository.php
Original file line number Diff line number Diff line change
@@ -67,6 +67,20 @@ public function processedJobsInPastMinutes($queues, $minutes)
return $total;
}

public function queueProcessedJobsInPastMinutes($queue, $minutes)
{
$redis = $this->getConnection();

$total = 0;
$queue_key = $this->queueProcessedJobsInPastMinutesKey($queue, $minutes);
$keys = $redis->keys($queue_key);
foreach($keys as $key)
{
$total += $redis->zcard($key);
}
return $total;
}

public function partitionProcessedJobsInPastMinutes($queue, $partition, $minutes)
{
$redis = $this->getConnection();
@@ -359,7 +373,9 @@ private function queuesWithPartitionsPrivate(
$queues[] = [
'queue' => $queue,
'partitions_count' => count($this->$partitionsResolver($queue)),
'jobs_count' => $this->totalJobsCount([$queue])
'jobs_count' => $this->totalJobsCount([$queue]),
'processed_jobs_count_1_min' => $this->queueProcessedJobsInPastMinutes($queue, 1),
'processed_jobs_count_20_min' => $this->queueProcessedJobsInPastMinutes($queue, 20),
];
}

0 comments on commit d075c3e

Please sign in to comment.