func ClearCounterForTesting(clusterName, edsServiceName string) {
	src.mu.Lock()
	defer src.mu.Unlock()
	k := clusterNameAndServiceName{
		clusterName:    clusterName,
		edsServcieName: edsServiceName,
	}
	c, ok := src.clusters[k]
	if !ok {
		return
	}
	c.numRequests = 0
}
ClearCounterForTesting clears the counter for the service. Should be only
used in tests.
package xdsclient
import (
	"fmt"
	"sync"
	"sync/atomic"
)
type clusterNameAndServiceName struct {
	clusterName, edsServcieName string
}
type clusterRequestsCounter struct {
	mu       sync.Mutex
	clusters map[clusterNameAndServiceName]*ClusterRequestsCounter
}
var src = &clusterRequestsCounter{
	clusters: make(map[clusterNameAndServiceName]*ClusterRequestsCounter),
}
type ClusterRequestsCounter struct {
	ClusterName    string
	EDSServiceName string
	numRequests    uint32
}
func GetClusterRequestsCounter(clusterName, edsServiceName string) *ClusterRequestsCounter {
	src.mu.Lock()
	defer src.mu.Unlock()
	k := clusterNameAndServiceName{
		clusterName:    clusterName,
		edsServcieName: edsServiceName,
	}
	c, ok := src.clusters[k]
	if !ok {
		c = &ClusterRequestsCounter{ClusterName: clusterName}
		src.clusters[k] = c
	}
	return c
}
func (c *ClusterRequestsCounter) StartRequest(max uint32) error {
	if atomic.LoadUint32(&c.numRequests) >= max {
		return fmt.Errorf("max requests %v exceeded on service %v", max, c.ClusterName)
	}
	atomic.AddUint32(&c.numRequests, 1)
	return nil
}
func (c *ClusterRequestsCounter) EndRequest() {
	atomic.AddUint32(&c.numRequests, ^uint32(0))
}