Skip to content

Commit

Permalink
Merge pull request #22 from aloware/hotfix/more-queue-stats
Browse files Browse the repository at this point in the history
More Queues Stats
  • Loading branch information
hamed-aloware authored Jun 20, 2022
2 parents 06531ee + d075c3e commit 6ae0a3b
Show file tree
Hide file tree
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
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
18 changes: 17 additions & 1 deletion src/Repositories/RedisRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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),
];
}

Expand Down

0 comments on commit 6ae0a3b

Please sign in to comment.