diff --git a/nsqadmin/graphs.go b/nsqadmin/graphs.go
index 024be0f44..18da0bfce 100644
--- a/nsqadmin/graphs.go
+++ b/nsqadmin/graphs.go
@@ -210,37 +210,6 @@ func (g *GraphOptions) Sparkline(gr GraphTarget, key string) template.URL {
return template.URL(fmt.Sprintf("%s/render?%s", g.GraphiteUrl, params.Encode()))
}
-func (g *GraphOptions) PercentileSparkline(gr GraphTarget, percentiles util.E2eProcessingLatencyAggregate) template.URL {
- key := fmt.Sprintf("e2e_processing_latency_%.0f", percentiles.Percentiles[0]["quantile"]*100)
- return g.Sparkline(gr, key)
-}
-
-func (g *GraphOptions) PercentileGraph(gr GraphTarget, percentiles util.E2eProcessingLatencyAggregate, height, width int) template.URL {
- params := url.Values{}
- params.Set("title", "end to end message processing latencies (milliseconds)")
- params.Set("height", fmt.Sprintf("%d", height))
- params.Set("width", fmt.Sprintf("%d", width))
- params.Set("bgcolor", "ff000000") // transparent
- params.Set("fgcolor", "999999")
- params.Set("yMin", "0")
- params.Set("lineMode", "connected")
- params.Set("drawNullAsZero", "false")
- interval := fmt.Sprintf("%dsec", *statsdInterval/time.Second)
-
- var target string
- for _, item := range percentiles.Percentiles {
- quantile := item["quantile"] * 100.0
- target, _ = gr.Target(fmt.Sprintf("e2e_processing_latency_%.0f", quantile))
- target = fmt.Sprintf(target, g.Prefix(gr.Host(), metricType("e2e_processing_latency")))
- target = fmt.Sprintf(`alias(summarize(scale(%s,0.000001),"%s","avg"), "%0.1f%%")`, target, interval, quantile)
- params.Add("target", target)
- }
-
- params.Set("from", g.GraphInterval.GraphFrom)
- params.Set("until", g.GraphInterval.GraphUntil)
- return template.URL(fmt.Sprintf("%s/render?%s", g.GraphiteUrl, params.Encode()))
-}
-
func (g *GraphOptions) LargeGraph(gr GraphTarget, key string) template.URL {
target, color := gr.Target(key)
target = fmt.Sprintf(target, g.Prefix(gr.Host(), metricType(key)))
@@ -251,6 +220,8 @@ func (g *GraphOptions) LargeGraph(gr GraphTarget, key string) template.URL {
params.Set("fgcolor", "999999")
params.Set("colorList", color)
params.Set("yMin", "0")
+ params.Set("lineMode", "connected")
+ params.Set("drawNullAsZero", "false")
interval := fmt.Sprintf("%dsec", *statsdInterval/time.Second)
target = fmt.Sprintf(`summarize(%s,"%s","avg")`, target, interval)
if metricType(key) == "counter" {
diff --git a/nsqadmin/http.go b/nsqadmin/http.go
index f0b36bb58..4e537ab63 100644
--- a/nsqadmin/http.go
+++ b/nsqadmin/http.go
@@ -26,6 +26,7 @@ func loadTemplates() {
"commafy": util.Commafy,
"nanotohuman": util.NanoSecondToHuman,
"floatToPercent": util.FloatToPercent,
+ "percSuffix": util.PercSuffix,
"getNodeConsistencyClass": getNodeConsistencyClass,
})
templates, err = t.ParseGlob(fmt.Sprintf("%s/*.html", *templateDir))
diff --git a/nsqadmin/templates/channel.html b/nsqadmin/templates/channel.html
index 5efd1438a..8b9e0ffe1 100644
--- a/nsqadmin/templates/channel.html
+++ b/nsqadmin/templates/channel.html
@@ -1,5 +1,6 @@
{{template "header.html" .}}
{{$g := .GraphOptions}}
+{{$firstHost := index .ChannelStats.HostStats 0}}
- Streams /
@@ -10,7 +11,7 @@
{{if and $g.Enabled .HasE2eLatency}}
-
+
{{end}}
@@ -73,10 +74,9 @@ Channel
|
Message Queues |
- {{if $g.Enabled}}
- Statistics |
- {{else}}
- Statistics |
+ Statistics |
+ {{if $firstHost.E2eProcessingLatency.Percentiles}}
+ E2E Processing Latency |
{{end}}
@@ -90,7 +90,9 @@ Channel
Messages |
{{if $g.Enabled}}Rate | {{end}}
Connections |
- {{if .HasE2eLatency}}E2E Processing Latency | {{end}}
+ {{range $e2e := $firstHost.E2eProcessingLatency.Percentiles}}
+ {{$e2e.quantile | floatToPercent}}{{$e2e.quantile | percSuffix}} |
+ {{end}}
@@ -108,11 +110,11 @@ Channel
{{if $g.Enabled}} | {{end}}
{{$c.ClientCount}} |
{{if $c.E2eProcessingLatency.Percentiles}}
+ {{range $e2e := $c.E2eProcessingLatency.Percentiles}}
- {{range $e2e := $c.E2eProcessingLatency.Percentiles}}
- {{$e2e.average | nanotohuman}}
- {{end}}
+ {{$e2e.average | nanotohuman}}
|
+ {{end}}
{{end}}
{{if $g.Enabled}}
@@ -127,7 +129,9 @@ Channel
|
|
|
- |
+ {{if $c.E2eProcessingLatency.Percentiles}}
+ |
+ {{end}}
{{end}}
@@ -145,11 +149,11 @@ Channel
{{if $g.Enabled}} | {{end}}
{{$c.ClientCount}} |
{{if $c.E2eProcessingLatency.Percentiles}}
+ {{range $e2e := $c.E2eProcessingLatency.Percentiles}}
- {{range $e2e := $c.E2eProcessingLatency.Percentiles}}
- {{$e2e.average | nanotohuman}}
- {{end}}
+ {{$e2e.average | nanotohuman}}
|
+ {{end}}
{{end}}
{{if $g.Enabled}}
@@ -164,7 +168,9 @@ Channel
|
|
|
- |
+ {{if $c.E2eProcessingLatency.Percentiles}}
+ |
+ {{end}}
{{end}}
diff --git a/nsqadmin/templates/topic.html b/nsqadmin/templates/topic.html
index 15ee5fbf5..4f177b201 100644
--- a/nsqadmin/templates/topic.html
+++ b/nsqadmin/templates/topic.html
@@ -1,6 +1,7 @@
{{template "header.html" .}}
{{$g := .GraphOptions}}
{{$gts := .GlobalTopicStats}}
+{{$firstTopic := index .TopicStats 0}}
- Streams /
@@ -10,7 +11,7 @@
{{if and $g.Enabled .HasE2eLatency}}
-
+
{{end}}
@@ -51,6 +52,12 @@ Notice
No producers exist for this topic.
Topic Message Queue
+ {{if $firstTopic.E2eProcessingLatency.Percentiles}}
+
+ |
+ E2E Processing Latency |
+
+ {{end}}
NSQd Host |
Depth |
@@ -58,7 +65,9 @@ Topic Message Queue
Messages |
{{if $g.Enabled}}Rate | {{end}}
Channels |
- {{if .HasE2eLatency}}E2E Processing Latency | {{end}}
+ {{range $e2e := $firstTopic.E2eProcessingLatency.Percentiles}}
+ {{$e2e.quantile | floatToPercent}}{{$e2e.quantile | percSuffix}} |
+ {{end}}
{{range $t := .TopicStats}}
@@ -81,12 +90,11 @@ Topic Message Queue
{{if $g.Enabled}} | {{end}}
{{.ChannelCount}} |
{{if $t.E2eProcessingLatency.Percentiles}}
-
- {{if $g.Enabled}}{{end}}
- {{range $e2e := $t.E2eProcessingLatency.Percentiles}}
- {{$e2e.average | nanotohuman}}
- {{end}}
- |
+ {{range $e2e := $t.E2eProcessingLatency.Percentiles}}
+
+ {{$e2e.average | nanotohuman}}
+ |
+ {{end}}
{{end}}
{{end}}
@@ -103,7 +111,13 @@ Topic Message Queue
{{if $g.Enabled}} | {{end}}
{{$gts.ChannelCount}} |
- {{if .HasE2eLatency}}{{if $g.Enabled}}{{end}} | {{end}}
+ {{if $gts.E2eProcessingLatency.Percentiles}}
+ {{range $e2e := $gts.E2eProcessingLatency.Percentiles}}
+
+ {{$e2e.average | nanotohuman}}
+ |
+ {{end}}
+ {{end}}
{{end}}
@@ -121,6 +135,12 @@
Notice
No channels exist for this topic.
Channel Message Queues
+ {{if $firstTopic.E2eProcessingLatency.Percentiles}}
+
+ |
+ E2E Processing Latency |
+
+ {{end}}
Channel |
Depth |
@@ -132,7 +152,9 @@ Channel Message Queues
Messages |
{{if $g.Enabled}}Rate | {{end}}
Connections |
- {{if .HasE2eLatency}}E2E Processing Latency | {{end}}
+ {{range $e2e := $firstTopic.E2eProcessingLatency.Percentiles}}
+ {{$e2e.quantile | floatToPercent}}{{$e2e.quantile | percSuffix}} |
+ {{end}}
{{range $c := .ChannelStats}}
@@ -151,15 +173,19 @@ Channel Message Queues
{{$c.MessageCount | commafy}} |
{{if $g.Enabled}} | {{end}}
- {{if $g.Enabled}}{{end}}
- {{$c.ClientCount}} |
+ {{if $g.Enabled}}
+
+
+
+ {{end}}
+ {{$c.ClientCount}}
+
{{if $c.E2eProcessingLatency.Percentiles}}
+ {{range $e2e := $c.E2eProcessingLatency.Percentiles}}
- {{if $g.Enabled}}{{end}}
- {{range $e2e := $c.E2eProcessingLatency.Percentiles}}
- {{$e2e.average | nanotohuman}}
- {{end}}
+ {{$e2e.average | nanotohuman}}
|
+ {{end}}
{{end}}
{{end}}
diff --git a/util/percentile.go b/util/percentile.go
index a1ea33a2a..90f6b8202 100644
--- a/util/percentile.go
+++ b/util/percentile.go
@@ -149,6 +149,14 @@ type E2eProcessingLatencyAggregate struct {
Percentiles []map[string]float64 `json:"percentiles"`
}
+func (n *E2eProcessingLatencyAggregate) Target(key string) (string, string) {
+ return fmt.Sprintf(`scale(%s,0.000001)`, key), ""
+}
+
+func (n *E2eProcessingLatencyAggregate) Host() string {
+ return "*"
+}
+
func E2eProcessingLatencyAggregateFromJson(j *simplejson.Json) *E2eProcessingLatencyAggregate {
count := j.Get("count").MustInt()
diff --git a/util/template_functions.go b/util/template_functions.go
index b83fe2c9d..9ad0ffe9f 100644
--- a/util/template_functions.go
+++ b/util/template_functions.go
@@ -23,5 +23,17 @@ func Commafy(i interface{}) string {
}
func FloatToPercent(i float64) string {
- return fmt.Sprintf("%0.1f%%", i*100.0)
+ return fmt.Sprintf("%.0f", i*100.0)
+}
+
+func PercSuffix(i float64) string {
+ switch int(i*100) % 10 {
+ case 1:
+ return "st"
+ case 2:
+ return "nd"
+ case 3:
+ return "rd"
+ }
+ return "th"
}