Skip to content

Commit

Permalink
Merge pull request #9760 from gyuho/stream
Browse files Browse the repository at this point in the history
etcdserver/api/v3rpc: add "etcd_network_server_stream_failures_total"
  • Loading branch information
gyuho authored May 23, 2018
2 parents 539e2f2 + a5b32ba commit bf45d6a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions etcdserver/api/v3rpc/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func (ls *LeaseServer) leaseKeepAlive(stream pb.Lease_LeaseKeepAliveServer) erro
} else {
plog.Warningf("failed to receive lease keepalive request from gRPC stream (%q)", err.Error())
}
streamFailures.WithLabelValues("receive", "lease-keepalive").Inc()
}
return err
}
Expand Down Expand Up @@ -160,6 +161,7 @@ func (ls *LeaseServer) leaseKeepAlive(stream pb.Lease_LeaseKeepAliveServer) erro
} else {
plog.Warningf("failed to send lease keepalive response to gRPC stream (%q)", err.Error())
}
streamFailures.WithLabelValues("send", "lease-keepalive").Inc()
}
return err
}
Expand Down
10 changes: 10 additions & 0 deletions etcdserver/api/v3rpc/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,19 @@ var (
Name: "client_grpc_received_bytes_total",
Help: "The total number of bytes received from grpc clients.",
})

streamFailures = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: "etcd",
Subsystem: "network",
Name: "server_stream_failures_total",
Help: "The total number of stream failures from the local server.",
},
[]string{"Type", "API"},
)
)

func init() {
prometheus.MustRegister(sentBytes)
prometheus.MustRegister(receivedBytes)
prometheus.MustRegister(streamFailures)
}
4 changes: 4 additions & 0 deletions etcdserver/api/v3rpc/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func (ws *watchServer) Watch(stream pb.Watch_WatchServer) (err error) {
} else {
plog.Warningf("failed to receive watch request from gRPC stream (%q)", rerr.Error())
}
streamFailures.WithLabelValues("receive", "watch").Inc()
}
errc <- rerr
}
Expand Down Expand Up @@ -416,6 +417,7 @@ func (sws *serverWatchStream) sendLoop() {
} else {
plog.Warningf("failed to send watch response to gRPC stream (%q)", serr.Error())
}
streamFailures.WithLabelValues("send", "watch").Inc()
}
return
}
Expand Down Expand Up @@ -445,6 +447,7 @@ func (sws *serverWatchStream) sendLoop() {
} else {
plog.Warningf("failed to send watch control response to gRPC stream (%q)", err.Error())
}
streamFailures.WithLabelValues("send", "watch").Inc()
}
return
}
Expand Down Expand Up @@ -473,6 +476,7 @@ func (sws *serverWatchStream) sendLoop() {
} else {
plog.Warningf("failed to send pending watch response to gRPC stream (%q)", err.Error())
}
streamFailures.WithLabelValues("send", "watch").Inc()
}
return
}
Expand Down

0 comments on commit bf45d6a

Please sign in to comment.