xds interop: update interop client to support new tests (#3737)
This commit is contained in:
@ -712,10 +712,12 @@ type LoadBalancerStatsResponse struct {
|
|||||||
// The number of completed RPCs for each peer.
|
// The number of completed RPCs for each peer.
|
||||||
RpcsByPeer map[string]int32 `protobuf:"bytes,1,rep,name=rpcs_by_peer,json=rpcsByPeer,proto3" json:"rpcs_by_peer,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
RpcsByPeer map[string]int32 `protobuf:"bytes,1,rep,name=rpcs_by_peer,json=rpcsByPeer,proto3" json:"rpcs_by_peer,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||||
// The number of RPCs that failed to record a remote peer.
|
// The number of RPCs that failed to record a remote peer.
|
||||||
NumFailures int32 `protobuf:"varint,2,opt,name=num_failures,json=numFailures,proto3" json:"num_failures,omitempty"`
|
NumFailures int32 `protobuf:"varint,2,opt,name=num_failures,json=numFailures,proto3" json:"num_failures,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
// The number of completed RPCs for each method (UnaryCall or EmptyCall).
|
||||||
XXX_unrecognized []byte `json:"-"`
|
RpcsByMethod map[string]*LoadBalancerStatsResponse_RpcsByPeer `protobuf:"bytes,3,rep,name=rpcs_by_method,json=rpcsByMethod,proto3" json:"rpcs_by_method,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||||
XXX_sizecache int32 `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *LoadBalancerStatsResponse) Reset() { *m = LoadBalancerStatsResponse{} }
|
func (m *LoadBalancerStatsResponse) Reset() { *m = LoadBalancerStatsResponse{} }
|
||||||
@ -757,6 +759,53 @@ func (m *LoadBalancerStatsResponse) GetNumFailures() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *LoadBalancerStatsResponse) GetRpcsByMethod() map[string]*LoadBalancerStatsResponse_RpcsByPeer {
|
||||||
|
if m != nil {
|
||||||
|
return m.RpcsByMethod
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type LoadBalancerStatsResponse_RpcsByPeer struct {
|
||||||
|
// The number of completed RPCs for each peer.
|
||||||
|
RpcsByPeer map[string]int32 `protobuf:"bytes,1,rep,name=rpcs_by_peer,json=rpcsByPeer,proto3" json:"rpcs_by_peer,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *LoadBalancerStatsResponse_RpcsByPeer) Reset() { *m = LoadBalancerStatsResponse_RpcsByPeer{} }
|
||||||
|
func (m *LoadBalancerStatsResponse_RpcsByPeer) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*LoadBalancerStatsResponse_RpcsByPeer) ProtoMessage() {}
|
||||||
|
func (*LoadBalancerStatsResponse_RpcsByPeer) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_534063719f48d90d, []int{11, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *LoadBalancerStatsResponse_RpcsByPeer) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_LoadBalancerStatsResponse_RpcsByPeer.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *LoadBalancerStatsResponse_RpcsByPeer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_LoadBalancerStatsResponse_RpcsByPeer.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *LoadBalancerStatsResponse_RpcsByPeer) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_LoadBalancerStatsResponse_RpcsByPeer.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *LoadBalancerStatsResponse_RpcsByPeer) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_LoadBalancerStatsResponse_RpcsByPeer.Size(m)
|
||||||
|
}
|
||||||
|
func (m *LoadBalancerStatsResponse_RpcsByPeer) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_LoadBalancerStatsResponse_RpcsByPeer.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_LoadBalancerStatsResponse_RpcsByPeer proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *LoadBalancerStatsResponse_RpcsByPeer) GetRpcsByPeer() map[string]int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.RpcsByPeer
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterEnum("grpc.testing.PayloadType", PayloadType_name, PayloadType_value)
|
proto.RegisterEnum("grpc.testing.PayloadType", PayloadType_name, PayloadType_value)
|
||||||
proto.RegisterEnum("grpc.testing.GrpclbRouteType", GrpclbRouteType_name, GrpclbRouteType_value)
|
proto.RegisterEnum("grpc.testing.GrpclbRouteType", GrpclbRouteType_name, GrpclbRouteType_value)
|
||||||
@ -772,75 +821,82 @@ func init() {
|
|||||||
proto.RegisterType((*StreamingOutputCallResponse)(nil), "grpc.testing.StreamingOutputCallResponse")
|
proto.RegisterType((*StreamingOutputCallResponse)(nil), "grpc.testing.StreamingOutputCallResponse")
|
||||||
proto.RegisterType((*LoadBalancerStatsRequest)(nil), "grpc.testing.LoadBalancerStatsRequest")
|
proto.RegisterType((*LoadBalancerStatsRequest)(nil), "grpc.testing.LoadBalancerStatsRequest")
|
||||||
proto.RegisterType((*LoadBalancerStatsResponse)(nil), "grpc.testing.LoadBalancerStatsResponse")
|
proto.RegisterType((*LoadBalancerStatsResponse)(nil), "grpc.testing.LoadBalancerStatsResponse")
|
||||||
|
proto.RegisterMapType((map[string]*LoadBalancerStatsResponse_RpcsByPeer)(nil), "grpc.testing.LoadBalancerStatsResponse.RpcsByMethodEntry")
|
||||||
proto.RegisterMapType((map[string]int32)(nil), "grpc.testing.LoadBalancerStatsResponse.RpcsByPeerEntry")
|
proto.RegisterMapType((map[string]int32)(nil), "grpc.testing.LoadBalancerStatsResponse.RpcsByPeerEntry")
|
||||||
|
proto.RegisterType((*LoadBalancerStatsResponse_RpcsByPeer)(nil), "grpc.testing.LoadBalancerStatsResponse.RpcsByPeer")
|
||||||
|
proto.RegisterMapType((map[string]int32)(nil), "grpc.testing.LoadBalancerStatsResponse.RpcsByPeer.RpcsByPeerEntry")
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("interop/grpc_testing/test.proto", fileDescriptor_534063719f48d90d) }
|
func init() { proto.RegisterFile("interop/grpc_testing/test.proto", fileDescriptor_534063719f48d90d) }
|
||||||
|
|
||||||
var fileDescriptor_534063719f48d90d = []byte{
|
var fileDescriptor_534063719f48d90d = []byte{
|
||||||
// 1019 bytes of a gzipped FileDescriptorProto
|
// 1083 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xfd, 0x6e, 0x1b, 0x45,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x72, 0xdb, 0xc4,
|
||||||
0x10, 0xcf, 0x39, 0x71, 0x1c, 0x8f, 0x5d, 0xc7, 0xdd, 0xb4, 0x70, 0x71, 0x28, 0x35, 0x07, 0xa2,
|
0x17, 0x8f, 0x1c, 0x3b, 0x8e, 0x8f, 0x5d, 0xc7, 0xd9, 0xb4, 0xff, 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, 0x54, 0xf3, 0xd2, 0xae,
|
0x87, 0xb1, 0x0c, 0xd5, 0xa1, 0x22, 0x8d, 0x28, 0x0e, 0xf9, 0x95, 0x11, 0x98, 0xd4, 0x27, 0x6a,
|
||||||
0x22, 0xe4, 0x7d, 0x21, 0x1e, 0x0a, 0x29, 0x39, 0x80, 0xed, 0x59, 0x92, 0x92, 0x37, 0xb5, 0x20,
|
0x4e, 0xda, 0x95, 0x85, 0xbc, 0x27, 0xc4, 0x03, 0x21, 0x45, 0x07, 0xb0, 0x35, 0x05, 0x29, 0x79,
|
||||||
0xf3, 0x50, 0x17, 0xf3, 0x98, 0xf1, 0xaa, 0x57, 0xa6, 0x05, 0xc4, 0x3c, 0x7f, 0x02, 0x12, 0xd4,
|
0x53, 0xf3, 0x12, 0x87, 0x3a, 0x8f, 0x63, 0xca, 0xab, 0x5e, 0x9e, 0x14, 0x10, 0xf1, 0xfc, 0x01,
|
||||||
0x08, 0x91, 0x5d, 0x21, 0x33, 0xec, 0xb1, 0x5a, 0x9c, 0xa5, 0x34, 0x94, 0xc2, 0xd3, 0x31, 0x79,
|
0xc8, 0xa0, 0x46, 0x40, 0xd8, 0x35, 0x61, 0x86, 0x3d, 0x52, 0x0b, 0x53, 0x48, 0x03, 0x29, 0x3c,
|
||||||
0x0a, 0xef, 0x49, 0x2b, 0x81, 0xea, 0x9c, 0x1b, 0xcc, 0x8f, 0x78, 0x42, 0x2b, 0x48, 0xeb, 0x1d,
|
0x1d, 0xa1, 0x67, 0xf0, 0x3f, 0x69, 0x25, 0xa2, 0x3a, 0x17, 0x06, 0xa3, 0x21, 0x8f, 0x69, 0x05,
|
||||||
0xa1, 0x3d, 0x91, 0x4a, 0x5d, 0xe8, 0x04, 0x85, 0xda, 0x1f, 0x39, 0xa8, 0xa4, 0x4d, 0x89, 0x63,
|
0x69, 0xbd, 0x23, 0xb4, 0x27, 0x52, 0xa9, 0x0b, 0x9d, 0xa0, 0x50, 0xfb, 0x25, 0x03, 0xe5, 0x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
|
0x87, 0xd8, 0x71, 0x92, 0x43, 0xba, 0x2a, 0x1d, 0xda, 0x39, 0x54, 0xd3, 0xa2, 0xc5, 0xec, 0x7e,
|
||||||
0xa9, 0x65, 0x31, 0xb4, 0x28, 0xc7, 0xb1, 0x91, 0xf8, 0xc4, 0xd3, 0x1b, 0x3f, 0xa3, 0xfb, 0x33,
|
0x06, 0xff, 0xc7, 0x96, 0xc5, 0x88, 0x85, 0x39, 0x19, 0x19, 0xb1, 0x4f, 0x74, 0x7a, 0xa3, 0x31,
|
||||||
0x75, 0x02, 0x2d, 0xc6, 0x58, 0x3b, 0x05, 0x92, 0x62, 0x0c, 0x28, 0xa3, 0x2e, 0x72, 0x64, 0xf2,
|
0x7a, 0x30, 0x55, 0xc7, 0xa1, 0xc5, 0x31, 0xd6, 0x4e, 0x01, 0x25, 0x31, 0xfa, 0x98, 0x61, 0x97,
|
||||||
0x05, 0xce, 0xb9, 0xca, 0xb3, 0xa0, 0x5c, 0xee, 0x8a, 0x2b, 0x2a, 0x66, 0x38, 0x79, 0x13, 0x90,
|
0x70, 0xc2, 0xe4, 0x04, 0xce, 0xb8, 0xca, 0xb5, 0xa0, 0x5c, 0xde, 0x15, 0xd7, 0x58, 0x9c, 0xe1,
|
||||||
0x8a, 0x46, 0xa1, 0xf6, 0x57, 0x6e, 0x2e, 0xc3, 0x7e, 0xc4, 0x97, 0x0a, 0x7e, 0xdb, 0x57, 0xf9,
|
0x78, 0x26, 0x20, 0x11, 0x0d, 0x03, 0xed, 0xb7, 0xcc, 0x0c, 0xc2, 0x5e, 0xc8, 0x17, 0x0a, 0xbe,
|
||||||
0x03, 0xec, 0x4c, 0xfd, 0x83, 0x69, 0xaa, 0x6a, 0xae, 0xbe, 0xde, 0x28, 0xb5, 0xea, 0x8b, 0x28,
|
0xeb, 0x54, 0x7e, 0x03, 0x3b, 0x13, 0x7f, 0x7f, 0x02, 0x55, 0xcd, 0xd4, 0xd6, 0xeb, 0xc5, 0x66,
|
||||||
0xab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, 0xb2, 0x83, 0x2e, 0xf1, 0x38, 0x19, 0x25, 0xa7, 0xe8, 0x05, 0x6c, 0xcf, 0xc9, 0x57,
|
||||||
0x00, 0xff, 0xff, 0xaa, 0x43, 0x4c, 0xeb, 0xf3, 0x0a, 0x00, 0x00,
|
0x3b, 0x4d, 0xcd, 0x9f, 0x53, 0xde, 0x80, 0x24, 0xb4, 0x09, 0xe5, 0x13, 0xc2, 0x0f, 0x1d, 0x9b,
|
||||||
|
0x78, 0x5c, 0x2a, 0xd0, 0x87, 0x6f, 0x9d, 0xd9, 0xa8, 0xb6, 0xc7, 0xb7, 0x9c, 0x6d, 0x6d, 0xad,
|
||||||
|
0xf5, 0xf4, 0xfb, 0x8f, 0x2d, 0x4a, 0x2d, 0x87, 0x34, 0x2c, 0xea, 0x60, 0xcf, 0x6a, 0x50, 0x66,
|
||||||
|
0xc9, 0x2f, 0x8a, 0xfd, 0xb4, 0xcf, 0x8b, 0x8b, 0x0d, 0xf9, 0x69, 0xf1, 0xec, 0xaf, 0x00, 0x00,
|
||||||
|
0x00, 0xff, 0xff, 0x8c, 0x0b, 0x8c, 0x16, 0x7d, 0x0c, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -214,10 +214,17 @@ message LoadBalancerStatsRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message LoadBalancerStatsResponse {
|
message LoadBalancerStatsResponse {
|
||||||
|
message RpcsByPeer {
|
||||||
|
// The number of completed RPCs for each peer.
|
||||||
|
map<string, int32> rpcs_by_peer = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// The number of completed RPCs for each peer.
|
// The number of completed RPCs for each peer.
|
||||||
map<string, int32> rpcs_by_peer = 1;
|
map<string, int32> rpcs_by_peer = 1;
|
||||||
// The number of RPCs that failed to record a remote peer.
|
// The number of RPCs that failed to record a remote peer.
|
||||||
int32 num_failures = 2;
|
int32 num_failures = 2;
|
||||||
|
// The number of completed RPCs for each method (UnaryCall or EmptyCall).
|
||||||
|
map<string, RpcsByPeer> rpcs_by_method = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A service used to obtain stats for verifying LB behavior.
|
// A service used to obtain stats for verifying LB behavior.
|
||||||
|
@ -23,13 +23,16 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/grpclog"
|
"google.golang.org/grpc/grpclog"
|
||||||
testpb "google.golang.org/grpc/interop/grpc_testing"
|
testpb "google.golang.org/grpc/interop/grpc_testing"
|
||||||
|
"google.golang.org/grpc/metadata"
|
||||||
"google.golang.org/grpc/peer"
|
"google.golang.org/grpc/peer"
|
||||||
_ "google.golang.org/grpc/xds"
|
_ "google.golang.org/grpc/xds"
|
||||||
)
|
)
|
||||||
@ -39,18 +42,43 @@ type statsWatcherKey struct {
|
|||||||
endID int32
|
endID int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rpcInfo contains the rpc type and the hostname where the response is received
|
||||||
|
// from.
|
||||||
|
type rpcInfo struct {
|
||||||
|
typ string
|
||||||
|
hostname string
|
||||||
|
}
|
||||||
|
|
||||||
type statsWatcher struct {
|
type statsWatcher struct {
|
||||||
rpcsByPeer map[string]int32
|
rpcsByPeer map[string]int32
|
||||||
|
rpcsByType map[string]map[string]int32
|
||||||
numFailures int32
|
numFailures int32
|
||||||
remainingRpcs int32
|
remainingRpcs int32
|
||||||
c chan *testpb.SimpleResponse
|
chanHosts chan *rpcInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
func (watcher *statsWatcher) buildResp() *testpb.LoadBalancerStatsResponse {
|
||||||
|
rpcsByType := make(map[string]*testpb.LoadBalancerStatsResponse_RpcsByPeer, len(watcher.rpcsByType))
|
||||||
|
for t, rpcsByPeer := range watcher.rpcsByType {
|
||||||
|
rpcsByType[t] = &testpb.LoadBalancerStatsResponse_RpcsByPeer{
|
||||||
|
RpcsByPeer: rpcsByPeer,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &testpb.LoadBalancerStatsResponse{
|
||||||
|
NumFailures: watcher.numFailures + watcher.remainingRpcs,
|
||||||
|
RpcsByPeer: watcher.rpcsByPeer,
|
||||||
|
RpcsByMethod: rpcsByType,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
failOnFailedRPC = flag.Bool("fail_on_failed_rpc", false, "Fail client if any RPCs fail")
|
failOnFailedRPC = flag.Bool("fail_on_failed_rpc", false, "Fail client if any RPCs fail")
|
||||||
numChannels = flag.Int("num_channels", 1, "Num of channels")
|
numChannels = flag.Int("num_channels", 1, "Num of channels")
|
||||||
printResponse = flag.Bool("print_response", false, "Write RPC response to stdout")
|
printResponse = flag.Bool("print_response", false, "Write RPC response to stdout")
|
||||||
qps = flag.Int("qps", 1, "QPS per channel")
|
qps = flag.Int("qps", 1, "QPS per channel, for each type of RPC")
|
||||||
|
rpc = flag.String("rpc", "UnaryCall", "Types of RPCs to make, ',' separated string. RPCs can be EmptyCall or UnaryCall")
|
||||||
|
rpcMetadata = flag.String("metadata", "", "The metadata to send with RPC, in format EmptyCall:key1:value1,UnaryCall:key2:value2")
|
||||||
rpcTimeout = flag.Duration("rpc_timeout", 20*time.Second, "Per RPC timeout")
|
rpcTimeout = flag.Duration("rpc_timeout", 20*time.Second, "Per RPC timeout")
|
||||||
server = flag.String("server", "localhost:8080", "Address of server to connect to")
|
server = flag.String("server", "localhost:8080", "Address of server to connect to")
|
||||||
statsPort = flag.Int("stats_port", 8081, "Port to expose peer distribution stats service")
|
statsPort = flag.Int("stats_port", 8081, "Port to expose peer distribution stats service")
|
||||||
@ -75,9 +103,10 @@ func (s *statsService) GetClientStats(ctx context.Context, in *testpb.LoadBalanc
|
|||||||
if !ok {
|
if !ok {
|
||||||
watcher = &statsWatcher{
|
watcher = &statsWatcher{
|
||||||
rpcsByPeer: make(map[string]int32),
|
rpcsByPeer: make(map[string]int32),
|
||||||
|
rpcsByType: make(map[string]map[string]int32),
|
||||||
numFailures: 0,
|
numFailures: 0,
|
||||||
remainingRpcs: in.GetNumRpcs(),
|
remainingRpcs: in.GetNumRpcs(),
|
||||||
c: make(chan *testpb.SimpleResponse),
|
chanHosts: make(chan *rpcInfo),
|
||||||
}
|
}
|
||||||
watchers[watcherKey] = watcher
|
watchers[watcherKey] = watcher
|
||||||
}
|
}
|
||||||
@ -95,25 +124,86 @@ func (s *statsService) GetClientStats(ctx context.Context, in *testpb.LoadBalanc
|
|||||||
// Wait until the requested RPCs have all been recorded or timeout occurs.
|
// Wait until the requested RPCs have all been recorded or timeout occurs.
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case r := <-watcher.c:
|
case info := <-watcher.chanHosts:
|
||||||
if r != nil {
|
if info != nil {
|
||||||
watcher.rpcsByPeer[(*r).GetHostname()]++
|
watcher.rpcsByPeer[info.hostname]++
|
||||||
|
|
||||||
|
rpcsByPeerForType := watcher.rpcsByType[info.typ]
|
||||||
|
if rpcsByPeerForType == nil {
|
||||||
|
rpcsByPeerForType = make(map[string]int32)
|
||||||
|
watcher.rpcsByType[info.typ] = rpcsByPeerForType
|
||||||
|
}
|
||||||
|
rpcsByPeerForType[info.hostname]++
|
||||||
} else {
|
} else {
|
||||||
watcher.numFailures++
|
watcher.numFailures++
|
||||||
}
|
}
|
||||||
watcher.remainingRpcs--
|
watcher.remainingRpcs--
|
||||||
if watcher.remainingRpcs == 0 {
|
if watcher.remainingRpcs == 0 {
|
||||||
return &testpb.LoadBalancerStatsResponse{NumFailures: watcher.numFailures + watcher.remainingRpcs, RpcsByPeer: watcher.rpcsByPeer}, nil
|
return watcher.buildResp(), nil
|
||||||
}
|
}
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
grpclog.Info("Timed out, returning partial stats")
|
grpclog.Info("Timed out, returning partial stats")
|
||||||
return &testpb.LoadBalancerStatsResponse{NumFailures: watcher.numFailures + watcher.remainingRpcs, RpcsByPeer: watcher.rpcsByPeer}, nil
|
return watcher.buildResp(), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
unaryCall string = "UnaryCall"
|
||||||
|
emptyCall string = "EmptyCall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func parseRPCTypes(rpcStr string) (ret []string) {
|
||||||
|
if len(rpcStr) == 0 {
|
||||||
|
return []string{unaryCall}
|
||||||
|
}
|
||||||
|
|
||||||
|
rpcs := strings.Split(rpcStr, ",")
|
||||||
|
for _, r := range rpcs {
|
||||||
|
switch r {
|
||||||
|
case unaryCall, emptyCall:
|
||||||
|
ret = append(ret, r)
|
||||||
|
default:
|
||||||
|
flag.PrintDefaults()
|
||||||
|
log.Fatalf("unsupported RPC type: %v", r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type rpcConfig struct {
|
||||||
|
typ string
|
||||||
|
md metadata.MD
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseRPCMetadata turns EmptyCall:key1:value1 into
|
||||||
|
// {typ: emptyCall, md: {key1:value1}}.
|
||||||
|
func parseRPCMetadata(rpcMetadataStr string, rpcs []string) []*rpcConfig {
|
||||||
|
rpcMetadataSplit := strings.Split(rpcMetadataStr, ",")
|
||||||
|
rpcsToMD := make(map[string][]string)
|
||||||
|
for _, rm := range rpcMetadataSplit {
|
||||||
|
rmSplit := strings.Split(rm, ":")
|
||||||
|
if len(rmSplit)%2 != 1 {
|
||||||
|
log.Fatalf("invalid metadata config %v, want EmptyCall:key1:value1", rm)
|
||||||
|
}
|
||||||
|
rpcsToMD[rmSplit[0]] = append(rpcsToMD[rmSplit[0]], rmSplit[1:]...)
|
||||||
|
}
|
||||||
|
ret := make([]*rpcConfig, 0, len(rpcs))
|
||||||
|
for _, rpcT := range rpcs {
|
||||||
|
rpcC := &rpcConfig{
|
||||||
|
typ: rpcT,
|
||||||
|
}
|
||||||
|
if md := rpcsToMD[string(rpcT)]; len(md) > 0 {
|
||||||
|
rpcC.md = metadata.Pairs(md...)
|
||||||
|
}
|
||||||
|
ret = append(ret, rpcC)
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
rpcCfgs := parseRPCMetadata(*rpcMetadata, parseRPCTypes(*rpc))
|
||||||
|
|
||||||
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *statsPort))
|
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *statsPort))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -135,16 +225,52 @@ func main() {
|
|||||||
}
|
}
|
||||||
ticker := time.NewTicker(time.Second / time.Duration(*qps**numChannels))
|
ticker := time.NewTicker(time.Second / time.Duration(*qps**numChannels))
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
sendRPCs(clients, ticker)
|
sendRPCs(clients, rpcCfgs, ticker)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendRPCs(clients []testpb.TestServiceClient, ticker *time.Ticker) {
|
func makeOneRPC(c testpb.TestServiceClient, cfg *rpcConfig) (*peer.Peer, *rpcInfo, error) {
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), *rpcTimeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
if len(cfg.md) != 0 {
|
||||||
|
ctx = metadata.NewOutgoingContext(ctx, cfg.md)
|
||||||
|
}
|
||||||
|
info := rpcInfo{typ: cfg.typ}
|
||||||
|
|
||||||
|
var (
|
||||||
|
p peer.Peer
|
||||||
|
header metadata.MD
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
switch cfg.typ {
|
||||||
|
case unaryCall:
|
||||||
|
var resp *testpb.SimpleResponse
|
||||||
|
resp, err = c.UnaryCall(ctx, &testpb.SimpleRequest{FillServerId: true}, grpc.Peer(&p), grpc.Header(&header))
|
||||||
|
// For UnaryCall, also read hostname from response, in case the server
|
||||||
|
// isn't updated to send headers.
|
||||||
|
if resp != nil {
|
||||||
|
info.hostname = resp.Hostname
|
||||||
|
}
|
||||||
|
case emptyCall:
|
||||||
|
_, err = c.EmptyCall(ctx, &testpb.Empty{}, grpc.Peer(&p), grpc.Header(&header))
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
hosts := header["hostname"]
|
||||||
|
if len(hosts) > 0 {
|
||||||
|
info.hostname = hosts[0]
|
||||||
|
}
|
||||||
|
return &p, &info, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func sendRPCs(clients []testpb.TestServiceClient, cfgs []*rpcConfig, ticker *time.Ticker) {
|
||||||
var i int
|
var i int
|
||||||
for range ticker.C {
|
for range ticker.C {
|
||||||
go func(i int) {
|
go func(i int) {
|
||||||
c := clients[i]
|
// Get and increment request ID, and save a list of watchers that
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), *rpcTimeout)
|
// are interested in this RPC.
|
||||||
p := new(peer.Peer)
|
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
savedRequestID := currentRequestID
|
savedRequestID := currentRequestID
|
||||||
currentRequestID++
|
currentRequestID++
|
||||||
@ -155,20 +281,32 @@ func sendRPCs(clients []testpb.TestServiceClient, ticker *time.Ticker) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
r, err := c.UnaryCall(ctx, &testpb.SimpleRequest{FillServerId: true}, grpc.Peer(p))
|
|
||||||
|
|
||||||
success := err == nil
|
c := clients[i]
|
||||||
cancel()
|
|
||||||
|
|
||||||
for _, watcher := range savedWatchers {
|
for _, cfg := range cfgs {
|
||||||
watcher.c <- r
|
p, info, err := makeOneRPC(c, cfg)
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil && *failOnFailedRPC {
|
for _, watcher := range savedWatchers {
|
||||||
grpclog.Fatalf("RPC failed: %v", err)
|
// This sends an empty string if the RPC failed.
|
||||||
}
|
watcher.chanHosts <- info
|
||||||
if success && *printResponse {
|
}
|
||||||
fmt.Printf("Greeting: Hello world, this is %s, from %v\n", r.GetHostname(), p.Addr)
|
if err != nil && *failOnFailedRPC {
|
||||||
|
grpclog.Fatalf("RPC failed: %v", err)
|
||||||
|
}
|
||||||
|
if *printResponse {
|
||||||
|
if err == nil {
|
||||||
|
if cfg.typ == unaryCall {
|
||||||
|
// Need to keep this format, because some tests are
|
||||||
|
// relying on stdout.
|
||||||
|
fmt.Printf("Greeting: Hello world, this is %s, from %v\n", info.hostname, p.Addr)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("RPC %q, from host %s, addr %v\n", cfg.typ, info.hostname, p.Addr)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Printf("RPC %q, failed with %v\n", cfg.typ, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}(i)
|
}(i)
|
||||||
i = (i + 1) % len(clients)
|
i = (i + 1) % len(clients)
|
||||||
|
@ -30,6 +30,7 @@ import (
|
|||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/grpclog"
|
"google.golang.org/grpc/grpclog"
|
||||||
testpb "google.golang.org/grpc/interop/grpc_testing"
|
testpb "google.golang.org/grpc/interop/grpc_testing"
|
||||||
|
"google.golang.org/grpc/metadata"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -50,7 +51,13 @@ type server struct {
|
|||||||
testpb.UnimplementedTestServiceServer
|
testpb.UnimplementedTestServiceServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *server) EmptyCall(ctx context.Context, _ *testpb.Empty) (*testpb.Empty, error) {
|
||||||
|
grpc.SetHeader(ctx, metadata.Pairs("hostname", hostname))
|
||||||
|
return &testpb.Empty{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *server) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
|
func (s *server) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
|
||||||
|
grpc.SetHeader(ctx, metadata.Pairs("hostname", hostname))
|
||||||
return &testpb.SimpleResponse{ServerId: *serverID, Hostname: hostname}, nil
|
return &testpb.SimpleResponse{ServerId: *serverID, Hostname: hostname}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user