From 852454a0a817742a42c1839c779de17ac323f538 Mon Sep 17 00:00:00 2001 From: Jehiah Czebotar Date: Wed, 17 Apr 2013 21:16:47 -0400 Subject: [PATCH] record deferred count as a gauge not a rate --- docs/production.md | 14 +++++++------- examples/nsq_stat/nsq_stat.go | 2 +- nsqadmin/graph_options.go | 2 +- nsqd/statsd.go | 3 +-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/production.md b/docs/production.md index 212b71746..f8a5a7edc 100644 --- a/docs/production.md +++ b/docs/production.md @@ -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._.topic..backend_depth - nsq._.topic..depth + nsq._.topic..backend_depth [gauge] + nsq._.topic..depth [gauge] nsq._.topic..message_count - nsq._.topic..channel..backend_depth - nsq._.topic..channel..clients - nsq._.topic..channel..deferred_count - nsq._.topic..channel..depth - nsq._.topic..channel..in_flight_count + nsq._.topic..channel..backend_depth [gauge] + nsq._.topic..channel..clients [gauge] + nsq._.topic..channel..deferred_count [gauge] + nsq._.topic..channel..depth [gauge] + nsq._.topic..channel..in_flight_count [gauge] nsq._.topic..channel..message_count nsq._.topic..channel..requeue_count nsq._.topic..channel..timeout_count diff --git a/examples/nsq_stat/nsq_stat.go b/examples/nsq_stat/nsq_stat.go index fc2fcc3e7..ba89dd13e 100644 --- a/examples/nsq_stat/nsq_stat.go +++ b/examples/nsq_stat/nsq_stat.go @@ -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") } diff --git a/nsqadmin/graph_options.go b/nsqadmin/graph_options.go index 3ec7b58ca..f35a8af43 100644 --- a/nsqadmin/graph_options.go +++ b/nsqadmin/graph_options.go @@ -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 diff --git a/nsqd/statsd.go b/nsqd/statsd.go index 7e8762d61..1f6f94ab4 100644 --- a/nsqd/statsd.go +++ b/nsqd/statsd.go @@ -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)