Skip to content

Commit

Permalink
Merge pull request #179 from jehiah/deferred_count_as_gauge_179
Browse files Browse the repository at this point in the history
record deferred_count as a guage instead of a counter in graphite
  • Loading branch information
mreiferson committed Apr 18, 2013
2 parents 18a13ce + 852454a commit 27cd09b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
14 changes: 7 additions & 7 deletions docs/production.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ In terms of topology, we recommend running `nsqd` co-located with services produ
`nsqd` can be configured to push data to [statsd][statsd] by specifying `--statsd-address`. By
turning this on, each `nsqd` instance will push to the following `statsd` paths:

nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.backend_depth
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.depth
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.backend_depth [gauge]
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.depth [gauge]
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.message_count
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.backend_depth
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.clients
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.deferred_count
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.depth
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.in_flight_count
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.backend_depth [gauge]
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.clients [gauge]
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.deferred_count [gauge]
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.depth [gauge]
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.in_flight_count [gauge]
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.message_count
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.requeue_count
nsq.<nsqd_host>_<nsqd_port>.topic.<topic_name>.channel.<channel_name>.timeout_count
Expand Down
2 changes: 1 addition & 1 deletion examples/nsq_stat/nsq_stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func statLoop(interval time.Duration, topic string, channel string,
c := allChannelStats[channel]
log.SetOutput(os.Stdout)

if i % 25 == 0 {
if i%25 == 0 {
fmt.Printf("-----------depth------------+--------------metadata---------------\n")
fmt.Printf("%7s %7s %5s %5s | %7s %7s %12s %7s\n", "mem", "disk", "inflt", "def", "req", "t-o", "msgs", "clients")
}
Expand Down
2 changes: 1 addition & 1 deletion nsqadmin/graph_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (g *GraphOptions) Rate(gr GraphTarget) string {
func metricType(key string) string {
metricType := "counter"
switch key {
case "backend_depth", "depth", "clients", "in_flight_count":
case "backend_depth", "depth", "clients", "in_flight_count", "deferred_count":
metricType = "gauge"
}
return metricType
Expand Down
3 changes: 1 addition & 2 deletions nsqd/statsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ func statsdLoop(addr string, prefix string, interval int) {
stat = fmt.Sprintf("topic.%s.channel.%s.in_flight_count", topic.TopicName, channel.ChannelName)
statsd.Gauge(stat, int(channel.InFlightCount))

diff = uint64(channel.DeferredCount - lastChannel.DeferredCount)
stat = fmt.Sprintf("topic.%s.channel.%s.deferred_count", topic.TopicName, channel.ChannelName)
statsd.Incr(stat, int(diff))
statsd.Gauge(stat, int(channel.DeferredCount))

diff = channel.RequeueCount - lastChannel.RequeueCount
stat = fmt.Sprintf("topic.%s.channel.%s.requeue_count", topic.TopicName, channel.ChannelName)
Expand Down

0 comments on commit 27cd09b

Please sign in to comment.