Skip to content

Commit

Permalink
Merge pull request #863 from ripienaar/micro_queue_groups
Browse files Browse the repository at this point in the history
Micro queue groups
  • Loading branch information
ripienaar authored Sep 19, 2023
2 parents 4716669 + e13a389 commit 1ca03aa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cli/micro_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func (c *microCmd) statsAction(_ *fisk.ParseContext) error {
}

table := newTableWriter(fmt.Sprintf("%s Service Statistics", c.name))
table.AddHeaders("ID", "Endpoint", "Requests", "Errors", "Processing Time", "Average Time")
table.AddHeaders("ID", "Endpoint", "Requests", "Queue Group", "Errors", "Processing Time", "Average Time")

var requests, errors int
var runTime time.Duration
Expand All @@ -316,7 +316,7 @@ func (c *microCmd) statsAction(_ *fisk.ParseContext) error {
id = ""
}

table.AddRow(id, e.Name, f(e.NumRequests), f(e.NumErrors), f(e.ProcessingTime), f(e.AverageProcessingTime))
table.AddRow(id, e.Name, f(e.NumRequests), e.QueueGroup, f(e.NumErrors), f(e.ProcessingTime), f(e.AverageProcessingTime))
requests += e.NumRequests
errors += e.NumErrors
runTime += e.ProcessingTime
Expand All @@ -328,7 +328,7 @@ func (c *microCmd) statsAction(_ *fisk.ParseContext) error {
avg = runTime / time.Duration(requests+errors)
}

table.AddFooter("", "", f(requests), f(errors), f(runTime), f(avg))
table.AddFooter("", "", f(requests), "", f(errors), f(runTime), f(avg))

fmt.Println(table.Render())

Expand Down Expand Up @@ -385,6 +385,9 @@ func (c *microCmd) infoAction(_ *fisk.ParseContext) error {
cols.Println()
cols.AddRow("Name", e.Name)
cols.AddRow("Subject", e.Subject)
if e.QueueGroup != "" {
cols.AddRow("Queue Group", e.QueueGroup)
}
if len(e.Metadata) > 0 {
cols.AddMapStringsAsValue("Metadata", e.Metadata)
}
Expand All @@ -400,7 +403,7 @@ func (c *microCmd) infoAction(_ *fisk.ParseContext) error {
cols.Indent(2)

cols.AddSectionTitle("%s Endpoint Statistics", e.Name)
cols.AddRow("Requests", e.NumRequests)
cols.AddRowf("Requests", "%s in group %s", f(e.NumRequests), e.QueueGroup)
cols.AddRowf("Processing Time", "%s (average %s)", f(e.ProcessingTime), f(e.AverageProcessingTime))
cols.AddRowf("Started:", "%s (%s ago)", f(stats.Started), f(time.Since(stats.Started)))
cols.AddRow("Errors", e.NumErrors)
Expand Down

0 comments on commit 1ca03aa

Please sign in to comment.