Skip to content

Commit

Permalink
filter producer stats if topic is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
mreiferson committed Aug 1, 2018
1 parent 2edbde4 commit a32fff3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions nsqd/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,28 @@ func (s *httpServer) doStats(w http.ResponseWriter, req *http.Request, ps httpro
break
}
}

filteredProducerStats := make([]ClientStats, 0)
for _, clientStat := range producerStats {
var found bool
var count uint64
for _, v := range clientStat.PubCounts {
if v.Topic == topicName {
count = v.Count
found = true
break
}
}
if !found {
continue
}
clientStat.PubCounts = []PubCount{PubCount{
Topic: topicName,
Count: count,
}}
filteredProducerStats = append(filteredProducerStats, clientStat)
}
producerStats = filteredProducerStats
}

ms := getMemStats()
Expand Down

0 comments on commit a32fff3

Please sign in to comment.