Skip to content

Commit

Permalink
Merge pull request #2844 from aledbf/fix-latency
Browse files Browse the repository at this point in the history
Do not allow invalid latency values in metrics
  • Loading branch information
k8s-ci-robot authored Jul 24, 2018
2 parents 43aabfc + 010342a commit bdb5ddc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/ingress/metric/collectors/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,13 @@ func (sc *SocketCollector) handleMessage(msg []byte) {
requestsMetric.Inc()
}

latencyMetric, err := sc.upstreamLatency.GetMetricWith(latencyLabels)
if err != nil {
glog.Errorf("Error fetching latency metric: %v", err)
} else {
latencyMetric.Observe(stats.Latency)
if stats.Latency != -1 {
latencyMetric, err := sc.upstreamLatency.GetMetricWith(latencyLabels)
if err != nil {
glog.Errorf("Error fetching latency metric: %v", err)
} else {
latencyMetric.Observe(stats.Latency)
}
}

if stats.RequestTime != -1 {
Expand Down

0 comments on commit bdb5ddc

Please sign in to comment.