mirror of
https://github.com/hibiken/asynq.git
synced 2024-12-25 23:32:17 +08:00
Show processed/failed count and error rate in asynqmon stats command
This commit is contained in:
parent
cde9d41580
commit
9b87f7c1f1
1
asynq.go
1
asynq.go
@ -7,7 +7,6 @@ TODOs:
|
|||||||
- [P0] asynqmon kill <taskID>, asynqmon killall <qname>
|
- [P0] asynqmon kill <taskID>, asynqmon killall <qname>
|
||||||
- [P0] Pagination for `asynqmon ls` command
|
- [P0] Pagination for `asynqmon ls` command
|
||||||
- [P0] Show elapsed time for InProgress tasks (asynqmon ls inprogress)
|
- [P0] Show elapsed time for InProgress tasks (asynqmon ls inprogress)
|
||||||
- [P0] Processed, Failed count for today
|
|
||||||
- [P0] Go docs + CONTRIBUTION.md + Github issue template + License comment
|
- [P0] Go docs + CONTRIBUTION.md + Github issue template + License comment
|
||||||
- [P0] Redis Sentinel support
|
- [P0] Redis Sentinel support
|
||||||
- [P1] Add Support for multiple queues and priority
|
- [P1] Add Support for multiple queues and priority
|
||||||
|
@ -58,14 +58,19 @@ func stats(cmd *cobra.Command, args []string) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
fmt.Println("QUEUES")
|
fmt.Println("QUEUES")
|
||||||
|
printQueues(stats)
|
||||||
|
fmt.Println()
|
||||||
|
|
||||||
|
fmt.Printf("STATS FOR %s UTC\n", stats.Timestamp.UTC().Format("2006-01-02"))
|
||||||
printStats(stats)
|
printStats(stats)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
|
||||||
fmt.Println("REDIS INFO")
|
fmt.Println("REDIS INFO")
|
||||||
printInfo(info)
|
printInfo(info)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
}
|
}
|
||||||
|
|
||||||
func printStats(s *rdb.Stats) {
|
func printQueues(s *rdb.Stats) {
|
||||||
format := strings.Repeat("%v\t", 5) + "\n"
|
format := strings.Repeat("%v\t", 5) + "\n"
|
||||||
tw := new(tabwriter.Writer).Init(os.Stdout, 0, 8, 2, ' ', 0)
|
tw := new(tabwriter.Writer).Init(os.Stdout, 0, 8, 2, ' ', 0)
|
||||||
fmt.Fprintf(tw, format, "InProgress", "Enqueued", "Scheduled", "Retry", "Dead")
|
fmt.Fprintf(tw, format, "InProgress", "Enqueued", "Scheduled", "Retry", "Dead")
|
||||||
@ -74,6 +79,15 @@ func printStats(s *rdb.Stats) {
|
|||||||
tw.Flush()
|
tw.Flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func printStats(s *rdb.Stats) {
|
||||||
|
format := strings.Repeat("%v\t", 3) + "\n"
|
||||||
|
tw := new(tabwriter.Writer).Init(os.Stdout, 0, 8, 2, ' ', 0)
|
||||||
|
fmt.Fprintf(tw, format, "Processed", "Failed", "Error Rate")
|
||||||
|
fmt.Fprintf(tw, format, "---------", "------", "----------")
|
||||||
|
fmt.Fprintf(tw, format, s.Processed, s.Failed, fmt.Sprintf("%.2f%%", float64(s.Failed)/float64(s.Processed)*100))
|
||||||
|
tw.Flush()
|
||||||
|
}
|
||||||
|
|
||||||
func printInfo(info map[string]string) {
|
func printInfo(info map[string]string) {
|
||||||
format := strings.Repeat("%v\t", 5) + "\n"
|
format := strings.Repeat("%v\t", 5) + "\n"
|
||||||
tw := new(tabwriter.Writer).Init(os.Stdout, 0, 8, 2, ' ', 0)
|
tw := new(tabwriter.Writer).Init(os.Stdout, 0, 8, 2, ' ', 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user