Ensure tap requests at least 1rps from each pod (#459)

When attempting to tap N pods when N is greater than the target rps, a rounding error occurs that requests 0 rps from each pod and no tap data is returned.

Ensure that tap requests at least 1 rps from each target pod.

Tested in Kubernetes on docker-for-desktop with a 15 replica deployment and a maxRps of 10.

Signed-off-by: Alex Leong <alex@buoyant.io>
This commit is contained in:
Alex Leong 2018-02-27 16:03:47 -08:00 committed by GitHub
parent 9ffe8b7970
commit 84ba1f3017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -66,6 +66,9 @@ func (s *server) Tap(req *public.TapRequest, stream pb.Tap_TapServer) error {
// divide the rps evenly between all pods to tap
rpsPerPod := req.MaxRps / float32(len(pods))
if rpsPerPod < 1 {
rpsPerPod = 1
}
for _, pod := range pods {
// initiate a tap on the pod