Merge pull request #8 from lovoo/fix-e2elatency
Fixes a panic with wrong values in e2elatency
This commit is contained in:
@ -48,6 +48,13 @@ type e2elatency struct {
|
|||||||
Percentiles []map[string]float64 `json:"percentiles"`
|
Percentiles []map[string]float64 `json:"percentiles"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e *e2elatency) percentileValue(idx int) float64 {
|
||||||
|
if idx >= len(e.Percentiles) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return e.Percentiles[idx]["value"]
|
||||||
|
}
|
||||||
|
|
||||||
type client struct {
|
type client struct {
|
||||||
ID string `json:"client_id"`
|
ID string `json:"client_id"`
|
||||||
Hostname string `json:"hostname"`
|
Hostname string `json:"hostname"`
|
||||||
|
@ -59,7 +59,7 @@ func ChannelStats(namespace string) StatsCollector {
|
|||||||
}, labels),
|
}, labels),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
val: func(c *channel) float64 { return c.E2eLatency.Percentiles[0]["value"] },
|
val: func(c *channel) float64 { return c.E2eLatency.percentileValue(0) },
|
||||||
vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Name: "e2e_latency_99p",
|
Name: "e2e_latency_99p",
|
||||||
@ -67,7 +67,7 @@ func ChannelStats(namespace string) StatsCollector {
|
|||||||
}, labels),
|
}, labels),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
val: func(c *channel) float64 { return c.E2eLatency.Percentiles[1]["value"] },
|
val: func(c *channel) float64 { return c.E2eLatency.percentileValue(1) },
|
||||||
vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
vec: prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Name: "e2e_latency_95p",
|
Name: "e2e_latency_95p",
|
||||||
|
Reference in New Issue
Block a user