func ClientStats(namespace string) StatsCollector {
	labels := []string{"topic", "channel", "deflate", "snappy", "tls", "client_id", "hostname", "version", "remote_address"}
	namespace += "_client"
	return clientStats{
		{
			val: func(c *client) float64 { return float64(c.State) },
			vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: namespace,
				Name:      "state",
				Help:      "State of client",
			}, labels),
		},
		{
			val: func(c *client) float64 { return float64(c.FinishCount) },
			vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: namespace,
				Name:      "finish_count",
				Help:      "Finish count",
			}, labels),
		},
		{
			val: func(c *client) float64 { return float64(c.MessageCount) },
			vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: namespace,
				Name:      "message_count",
				Help:      "Queue message count",
			}, labels),
		},
		{
			val: func(c *client) float64 { return float64(c.ReadyCount) },
			vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: namespace,
				Name:      "ready_count",
				Help:      "Ready count",
			}, labels),
		},
		{
			val: func(c *client) float64 { return float64(c.InFlightCount) },
			vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: namespace,
				Name:      "in_flight_count",
				Help:      "In flight count",
			}, labels),
		},
		{
			val: func(c *client) float64 { return float64(c.RequeueCount) },
			vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: namespace,
				Name:      "requeue_count",
				Help:      "Requeue count",
			}, labels),
		},
		{
			val: func(c *client) float64 { return float64(c.ConnectTime) },
			vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: namespace,
				Name:      "connect_ts",
				Help:      "Connect timestamp",
			}, labels),
		},
		{
			val: func(c *client) float64 { return float64(c.SampleRate) },
			vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: namespace,
				Name:      "sample_rate",
				Help:      "Sample Rate",
			}, labels),
		},
	}
}
ClientStats creates a new stats collector which is able to
expose the client metrics of a nsqd node to Prometheus. The
client metrics are reported per topic and per channel.

If there are too many clients, it could cause a timeout of the
Prometheus collection process. So be sure the number of clients
is small enough when using this collector.
package collector
import (
	"strconv"
	"github.com/prometheus/client_golang/prometheus"
)
type clientStats []struct {
	val func(*client) float64
	vec *prometheus.GaugeVec
}