squashed commits

This commit is contained in:
Dnile
2016-04-02 09:06:00 -07:00
parent f9035d0814
commit 30565eb641
6 changed files with 200 additions and 10 deletions

View File

@ -25,20 +25,27 @@ type topic struct {
Depth int64 `json:"depth"`
BackendDepth int64 `json:"backend_depth"`
MessageCount uint64 `json:"message_count"`
E2eLatency e2elatency `json:"e2e_processing_latency"`
Channels []*channel `json:"channels"`
}
type channel struct {
Name string `json:"channel_name"`
Paused bool `json:"paused"`
Depth int64 `json:"depth"`
BackendDepth int64 `json:"backend_depth"`
MessageCount uint64 `json:"message_count"`
InFlightCount int `json:"in_flight_count"`
DeferredCount int `json:"deferred_count"`
RequeueCount uint64 `json:"requeue_count"`
TimeoutCount uint64 `json:"timeout_count"`
Clients []*client `json:"clients"`
Name string `json:"channel_name"`
Paused bool `json:"paused"`
Depth int64 `json:"depth"`
BackendDepth int64 `json:"backend_depth"`
MessageCount uint64 `json:"message_count"`
InFlightCount int `json:"in_flight_count"`
DeferredCount int `json:"deferred_count"`
RequeueCount uint64 `json:"requeue_count"`
TimeoutCount uint64 `json:"timeout_count"`
E2eLatency e2elatency `json:"e2e_processing_latency"`
Clients []*client `json:"clients"`
}
type e2elatency struct {
Count int `json:"count"`
Percentiles []map[string]float64 `json:"percentiles"`
}
type client struct {
@ -60,6 +67,7 @@ type client struct {
}
func getNsqdStats(nsqdURL string) (*stats, error) {
resp, err := http.Get(nsqdURL)
if err != nil {
return nil, err

View File

@ -58,6 +58,22 @@ func ChannelStats(namespace string) StatsCollector {
Help: "In flight count",
}, labels),
},
{
val: func(c *channel) float64 { return c.E2eLatency.Percentiles[0]["value"] },
vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Name: "e2e_latency_99p",
Help: "e2e latency 99th percentile",
}, labels),
},
{
val: func(c *channel) float64 { return c.E2eLatency.Percentiles[1]["value"] },
vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Name: "e2e_latency_95p",
Help: "e2e latency 95th percentile",
}, labels),
},
{
val: func(c *channel) float64 { return float64(c.DeferredCount) },
vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{

View File

@ -41,6 +41,22 @@ func TopicStats(namespace string) StatsCollector {
Help: "Queue backend depth",
}, labels),
},
{
val: func(t *topic) float64 { return t.E2eLatency.Percentiles[0]["value"] },
vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Name: "e2e_latency_99_percentile",
Help: "Queue e2e latency 99th percentile",
}, labels),
},
{
val: func(t *topic) float64 { return t.E2eLatency.Percentiles[1]["value"] },
vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Name: "e2e_latency_95_percentile",
Help: "Queue e2e latency 95th percentile",
}, labels),
},
{
val: func(t *topic) float64 { return float64(t.MessageCount) },
vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{