diff --git a/channelz/service/service.go b/channelz/service/service.go new file mode 100644 index 00000000..bd7f45ac --- /dev/null +++ b/channelz/service/service.go @@ -0,0 +1,265 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +//go:generate protoc -I ../service_proto --go_out=plugins=grpc:../service_proto ../service_proto/service.proto + +// Package service provides an implementation for channelz service server. +package service + +import ( + "net" + + "github.com/golang/protobuf/ptypes" + "github.com/golang/protobuf/ptypes/wrappers" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/channelz" + pb "google.golang.org/grpc/channelz/service_proto" + "google.golang.org/grpc/connectivity" +) + +// RegisterChannelzServiceToServer registers the channelz service to the given server. +func RegisterChannelzServiceToServer(s *grpc.Server) { + pb.RegisterChannelzServer(s, &serverImpl{}) +} + +func newCZServer() pb.ChannelzServer { + return &serverImpl{} +} + +type serverImpl struct{} + +func connectivityStateToProto(s connectivity.State) *pb.ChannelConnectivityState { + switch s { + case connectivity.Idle: + return &pb.ChannelConnectivityState{State: pb.ChannelConnectivityState_IDLE} + case connectivity.Connecting: + return &pb.ChannelConnectivityState{State: pb.ChannelConnectivityState_CONNECTING} + case connectivity.Ready: + return &pb.ChannelConnectivityState{State: pb.ChannelConnectivityState_READY} + case connectivity.TransientFailure: + return &pb.ChannelConnectivityState{State: pb.ChannelConnectivityState_TRANSIENT_FAILURE} + case connectivity.Shutdown: + return &pb.ChannelConnectivityState{State: pb.ChannelConnectivityState_SHUTDOWN} + default: + return &pb.ChannelConnectivityState{State: pb.ChannelConnectivityState_UNKNOWN} + } +} + +func channelMetricToProto(cm *channelz.ChannelMetric) *pb.Channel { + c := &pb.Channel{} + c.Ref = &pb.ChannelRef{ChannelId: cm.ID, Name: cm.RefName} + + c.Data = &pb.ChannelData{ + State: connectivityStateToProto(cm.ChannelData.State), + Target: cm.ChannelData.Target, + CallsStarted: cm.ChannelData.CallsStarted, + CallsSucceeded: cm.ChannelData.CallsSucceeded, + CallsFailed: cm.ChannelData.CallsFailed, + } + if ts, err := ptypes.TimestampProto(cm.ChannelData.LastCallStartedTimestamp); err == nil { + c.Data.LastCallStartedTimestamp = ts + } + nestedChans := make([]*pb.ChannelRef, 0, len(cm.NestedChans)) + for id, ref := range cm.NestedChans { + nestedChans = append(nestedChans, &pb.ChannelRef{ChannelId: id, Name: ref}) + } + c.ChannelRef = nestedChans + + subChans := make([]*pb.SubchannelRef, 0, len(cm.SubChans)) + for id, ref := range cm.SubChans { + subChans = append(subChans, &pb.SubchannelRef{SubchannelId: id, Name: ref}) + } + c.SubchannelRef = subChans + + sockets := make([]*pb.SocketRef, 0, len(cm.Sockets)) + for id, ref := range cm.Sockets { + sockets = append(sockets, &pb.SocketRef{SocketId: id, Name: ref}) + } + c.SocketRef = sockets + return c +} + +func subChannelMetricToProto(cm *channelz.SubChannelMetric) *pb.Subchannel { + sc := &pb.Subchannel{} + sc.Ref = &pb.SubchannelRef{SubchannelId: cm.ID, Name: cm.RefName} + + sc.Data = &pb.ChannelData{ + State: connectivityStateToProto(cm.ChannelData.State), + Target: cm.ChannelData.Target, + CallsStarted: cm.ChannelData.CallsStarted, + CallsSucceeded: cm.ChannelData.CallsSucceeded, + CallsFailed: cm.ChannelData.CallsFailed, + } + if ts, err := ptypes.TimestampProto(cm.ChannelData.LastCallStartedTimestamp); err == nil { + sc.Data.LastCallStartedTimestamp = ts + } + nestedChans := make([]*pb.ChannelRef, 0, len(cm.NestedChans)) + for id, ref := range cm.NestedChans { + nestedChans = append(nestedChans, &pb.ChannelRef{ChannelId: id, Name: ref}) + } + sc.ChannelRef = nestedChans + + subChans := make([]*pb.SubchannelRef, 0, len(cm.SubChans)) + for id, ref := range cm.SubChans { + subChans = append(subChans, &pb.SubchannelRef{SubchannelId: id, Name: ref}) + } + sc.SubchannelRef = subChans + + sockets := make([]*pb.SocketRef, 0, len(cm.Sockets)) + for id, ref := range cm.Sockets { + sockets = append(sockets, &pb.SocketRef{SocketId: id, Name: ref}) + } + sc.SocketRef = sockets + return sc +} + +func addrToProto(a net.Addr) *pb.Address { + switch a.Network() { + case "udp": + // TODO: Address_OtherAddress{}. Need proto def for Value. + case "ip": + // Note zone info is discarded through the conversion. + return &pb.Address{Address: &pb.Address_TcpipAddress{TcpipAddress: &pb.Address_TcpIpAddress{IpAddress: a.(*net.IPAddr).IP}}} + case "ip+net": + // Note mask info is discarded through the conversion. + return &pb.Address{Address: &pb.Address_TcpipAddress{TcpipAddress: &pb.Address_TcpIpAddress{IpAddress: a.(*net.IPNet).IP}}} + case "tcp": + // Note zone info is discarded through the conversion. + return &pb.Address{Address: &pb.Address_TcpipAddress{TcpipAddress: &pb.Address_TcpIpAddress{IpAddress: a.(*net.TCPAddr).IP, Port: int32(a.(*net.TCPAddr).Port)}}} + case "unix", "unixgram", "unixpacket": + return &pb.Address{Address: &pb.Address_UdsAddress_{UdsAddress: &pb.Address_UdsAddress{Filename: a.String()}}} + default: + } + return &pb.Address{} +} + +func socketMetricToProto(sm *channelz.SocketMetric) *pb.Socket { + s := &pb.Socket{} + s.Ref = &pb.SocketRef{SocketId: sm.ID, Name: sm.RefName} + + s.Data = &pb.SocketData{ + StreamsStarted: sm.SocketData.StreamsStarted, + StreamsSucceeded: sm.SocketData.StreamsSucceeded, + StreamsFailed: sm.SocketData.StreamsFailed, + MessagesSent: sm.SocketData.MessagesSent, + MessagesReceived: sm.SocketData.MessagesReceived, + KeepAlivesSent: sm.SocketData.KeepAlivesSent, + } + if ts, err := ptypes.TimestampProto(sm.SocketData.LastLocalStreamCreatedTimestamp); err == nil { + s.Data.LastLocalStreamCreatedTimestamp = ts + } + if ts, err := ptypes.TimestampProto(sm.SocketData.LastRemoteStreamCreatedTimestamp); err == nil { + s.Data.LastRemoteStreamCreatedTimestamp = ts + } + if ts, err := ptypes.TimestampProto(sm.SocketData.LastMessageSentTimestamp); err == nil { + s.Data.LastMessageSentTimestamp = ts + } + if ts, err := ptypes.TimestampProto(sm.SocketData.LastMessageReceivedTimestamp); err == nil { + s.Data.LastMessageReceivedTimestamp = ts + } + s.Data.LocalFlowControlWindow = &wrappers.Int64Value{Value: sm.SocketData.LocalFlowControlWindow} + s.Data.RemoteFlowControlWindow = &wrappers.Int64Value{Value: sm.SocketData.RemoteFlowControlWindow} + + if sm.SocketData.LocalAddr != nil { + s.Local = addrToProto(sm.SocketData.LocalAddr) + } + if sm.SocketData.RemoteAddr != nil { + s.Remote = addrToProto(sm.SocketData.RemoteAddr) + } + s.RemoteName = sm.SocketData.RemoteName + return s +} + +func (s *serverImpl) GetTopChannels(ctx context.Context, req *pb.GetTopChannelsRequest) (*pb.GetTopChannelsResponse, error) { + metrics, end := channelz.GetTopChannels(req.GetStartChannelId()) + resp := &pb.GetTopChannelsResponse{} + for _, m := range metrics { + resp.Channel = append(resp.Channel, channelMetricToProto(m)) + } + resp.End = end + return resp, nil +} + +func serverMetricToProto(sm *channelz.ServerMetric) *pb.Server { + s := &pb.Server{} + s.Ref = &pb.ServerRef{ServerId: sm.ID, Name: sm.RefName} + + s.Data = &pb.ServerData{ + CallsStarted: sm.ServerData.CallsStarted, + CallsSucceeded: sm.ServerData.CallsSucceeded, + CallsFailed: sm.ServerData.CallsFailed, + } + + if ts, err := ptypes.TimestampProto(sm.ServerData.LastCallStartedTimestamp); err == nil { + s.Data.LastCallStartedTimestamp = ts + } + sockets := make([]*pb.SocketRef, 0, len(sm.ListenSockets)) + for id, ref := range sm.ListenSockets { + sockets = append(sockets, &pb.SocketRef{SocketId: id, Name: ref}) + } + s.ListenSocket = sockets + return s +} + +func (s *serverImpl) GetServers(ctx context.Context, req *pb.GetServersRequest) (*pb.GetServersResponse, error) { + metrics, end := channelz.GetServers(req.GetStartServerId()) + resp := &pb.GetServersResponse{} + for _, m := range metrics { + resp.Server = append(resp.Server, serverMetricToProto(m)) + } + resp.End = end + return resp, nil +} + +func (s *serverImpl) GetServerSockets(ctx context.Context, req *pb.GetServerSocketsRequest) (*pb.GetServerSocketsResponse, error) { + metrics, end := channelz.GetServerSockets(req.GetServerId(), req.GetStartSocketId()) + resp := &pb.GetServerSocketsResponse{} + for _, m := range metrics { + resp.SocketRef = append(resp.SocketRef, &pb.SocketRef{SocketId: m.ID, Name: m.RefName}) + } + resp.End = end + return resp, nil +} + +func (s *serverImpl) GetChannel(ctx context.Context, req *pb.GetChannelRequest) (*pb.GetChannelResponse, error) { + var metric *channelz.ChannelMetric + if metric = channelz.GetChannel(req.GetChannelId()); metric == nil { + return &pb.GetChannelResponse{}, nil + } + resp := &pb.GetChannelResponse{Channel: channelMetricToProto(metric)} + return resp, nil +} + +func (s *serverImpl) GetSubchannel(ctx context.Context, req *pb.GetSubchannelRequest) (*pb.GetSubchannelResponse, error) { + var metric *channelz.SubChannelMetric + if metric = channelz.GetSubChannel(req.GetSubchannelId()); metric == nil { + return &pb.GetSubchannelResponse{}, nil + } + resp := &pb.GetSubchannelResponse{Subchannel: subChannelMetricToProto(metric)} + return resp, nil +} + +func (s *serverImpl) GetSocket(ctx context.Context, req *pb.GetSocketRequest) (*pb.GetSocketResponse, error) { + var metric *channelz.SocketMetric + if metric = channelz.GetSocket(req.GetSocketId()); metric == nil { + return &pb.GetSocketResponse{}, nil + } + resp := &pb.GetSocketResponse{Socket: socketMetricToProto(metric)} + return resp, nil +} diff --git a/channelz/service/service_test.go b/channelz/service/service_test.go new file mode 100644 index 00000000..7cf156ac --- /dev/null +++ b/channelz/service/service_test.go @@ -0,0 +1,477 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package service + +import ( + "net" + "reflect" + "strconv" + "testing" + "time" + + "github.com/golang/protobuf/ptypes" + "golang.org/x/net/context" + "google.golang.org/grpc/channelz" + pb "google.golang.org/grpc/channelz/service_proto" + "google.golang.org/grpc/connectivity" +) + +func init() { + channelz.TurnOn() +} + +// emptyTime is used for detecting unset value of time.Time type. +// For go1.7 and earlier, ptypes.Timestamp will fill in the loc field of time.Time +// with &utcLoc. However zero value of a time.Time type value loc field is nil. +// This behavior will make reflect.DeepEqual fail upon unset time.Time field, +// and cause false positive fatal error. +var emptyTime time.Time + +type dummyChannel struct { + state connectivity.State + target string + callsStarted int64 + callsSucceeded int64 + callsFailed int64 + lastCallStartedTimestamp time.Time +} + +func (d *dummyChannel) ChannelzMetric() *channelz.ChannelInternalMetric { + return &channelz.ChannelInternalMetric{ + State: d.state, + Target: d.target, + CallsStarted: d.callsStarted, + CallsSucceeded: d.callsSucceeded, + CallsFailed: d.callsFailed, + LastCallStartedTimestamp: d.lastCallStartedTimestamp, + } +} + +type dummyServer struct { + callsStarted int64 + callsSucceeded int64 + callsFailed int64 + lastCallStartedTimestamp time.Time +} + +func (d *dummyServer) ChannelzMetric() *channelz.ServerInternalMetric { + return &channelz.ServerInternalMetric{ + CallsStarted: d.callsStarted, + CallsSucceeded: d.callsSucceeded, + CallsFailed: d.callsFailed, + LastCallStartedTimestamp: d.lastCallStartedTimestamp, + } +} + +type dummySocket struct { + streamsStarted int64 + streamsSucceeded int64 + streamsFailed int64 + messagesSent int64 + messagesReceived int64 + keepAlivesSent int64 + lastLocalStreamCreatedTimestamp time.Time + lastRemoteStreamCreatedTimestamp time.Time + lastMessageSentTimestamp time.Time + lastMessageReceivedTimestamp time.Time + localFlowControlWindow int64 + remoteFlowControlWindow int64 + //socket options + localAddr net.Addr + remoteAddr net.Addr + // Security + remoteName string +} + +func (d *dummySocket) ChannelzMetric() *channelz.SocketInternalMetric { + return &channelz.SocketInternalMetric{ + StreamsStarted: d.streamsStarted, + StreamsSucceeded: d.streamsSucceeded, + StreamsFailed: d.streamsFailed, + MessagesSent: d.messagesSent, + MessagesReceived: d.messagesReceived, + KeepAlivesSent: d.keepAlivesSent, + LastLocalStreamCreatedTimestamp: d.lastLocalStreamCreatedTimestamp, + LastRemoteStreamCreatedTimestamp: d.lastRemoteStreamCreatedTimestamp, + LastMessageSentTimestamp: d.lastMessageSentTimestamp, + LastMessageReceivedTimestamp: d.lastMessageReceivedTimestamp, + LocalFlowControlWindow: d.localFlowControlWindow, + RemoteFlowControlWindow: d.remoteFlowControlWindow, + //socket options + LocalAddr: d.localAddr, + RemoteAddr: d.remoteAddr, + // Security + RemoteName: d.remoteName, + } +} + +func channelProtoToStruct(c *pb.Channel) *dummyChannel { + dc := &dummyChannel{} + pdata := c.GetData() + switch pdata.GetState().GetState() { + case pb.ChannelConnectivityState_UNKNOWN: + // TODO: what should we set here? + case pb.ChannelConnectivityState_IDLE: + dc.state = connectivity.Idle + case pb.ChannelConnectivityState_CONNECTING: + dc.state = connectivity.Connecting + case pb.ChannelConnectivityState_READY: + dc.state = connectivity.Ready + case pb.ChannelConnectivityState_TRANSIENT_FAILURE: + dc.state = connectivity.TransientFailure + case pb.ChannelConnectivityState_SHUTDOWN: + dc.state = connectivity.Shutdown + } + dc.target = pdata.GetTarget() + dc.callsStarted = pdata.CallsStarted + dc.callsSucceeded = pdata.CallsSucceeded + dc.callsFailed = pdata.CallsFailed + if t, err := ptypes.Timestamp(pdata.GetLastCallStartedTimestamp()); err == nil { + if !t.Equal(emptyTime) { + dc.lastCallStartedTimestamp = t + } + } + return dc +} + +func serverProtoToStruct(s *pb.Server) *dummyServer { + ds := &dummyServer{} + pdata := s.GetData() + ds.callsStarted = pdata.CallsStarted + ds.callsSucceeded = pdata.CallsSucceeded + ds.callsFailed = pdata.CallsFailed + if t, err := ptypes.Timestamp(pdata.GetLastCallStartedTimestamp()); err == nil { + if !t.Equal(emptyTime) { + ds.lastCallStartedTimestamp = t + } + } + return ds +} + +func protoToAddr(a *pb.Address) net.Addr { + switch v := a.Address.(type) { + case *pb.Address_TcpipAddress: + if port := v.TcpipAddress.GetPort(); port != 0 { + return &net.TCPAddr{IP: v.TcpipAddress.GetIpAddress(), Port: int(port)} + } + return &net.IPAddr{IP: v.TcpipAddress.GetIpAddress()} + case *pb.Address_UdsAddress_: + return &net.UnixAddr{Name: v.UdsAddress.GetFilename(), Net: "unix"} + case *pb.Address_OtherAddress_: + // TODO: + } + return nil +} + +func socketProtoToStruct(s *pb.Socket) *dummySocket { + ds := &dummySocket{} + pdata := s.GetData() + ds.streamsStarted = pdata.GetStreamsStarted() + ds.streamsSucceeded = pdata.GetStreamsSucceeded() + ds.streamsFailed = pdata.GetStreamsFailed() + ds.messagesSent = pdata.GetMessagesSent() + ds.messagesReceived = pdata.GetMessagesReceived() + ds.keepAlivesSent = pdata.GetKeepAlivesSent() + if t, err := ptypes.Timestamp(pdata.GetLastLocalStreamCreatedTimestamp()); err == nil { + if !t.Equal(emptyTime) { + ds.lastLocalStreamCreatedTimestamp = t + } + } + if t, err := ptypes.Timestamp(pdata.GetLastRemoteStreamCreatedTimestamp()); err == nil { + if !t.Equal(emptyTime) { + ds.lastRemoteStreamCreatedTimestamp = t + } + } + if t, err := ptypes.Timestamp(pdata.GetLastMessageSentTimestamp()); err == nil { + if !t.Equal(emptyTime) { + ds.lastMessageSentTimestamp = t + } + } + if t, err := ptypes.Timestamp(pdata.GetLastMessageReceivedTimestamp()); err == nil { + if !t.Equal(emptyTime) { + ds.lastMessageReceivedTimestamp = t + } + } + if v := pdata.GetLocalFlowControlWindow(); v != nil { + ds.localFlowControlWindow = v.Value + } + if v := pdata.GetRemoteFlowControlWindow(); v != nil { + ds.remoteFlowControlWindow = v.Value + } + if local := s.GetLocal(); local != nil { + ds.localAddr = protoToAddr(local) + } + if remote := s.GetRemote(); remote != nil { + ds.remoteAddr = protoToAddr(remote) + } + ds.remoteName = s.GetRemoteName() + return ds +} + +func convertSocketRefSliceToMap(sktRefs []*pb.SocketRef) map[int64]string { + m := make(map[int64]string) + for _, sr := range sktRefs { + m[sr.SocketId] = sr.Name + } + return m +} + +func TestGetTopChannels(t *testing.T) { + tcs := []*dummyChannel{ + { + state: connectivity.Connecting, + target: "test.channelz:1234", + callsStarted: 6, + callsSucceeded: 2, + callsFailed: 3, + lastCallStartedTimestamp: time.Now().UTC(), + }, + { + state: connectivity.Connecting, + target: "test.channelz:1234", + callsStarted: 1, + callsSucceeded: 2, + callsFailed: 3, + lastCallStartedTimestamp: time.Now().UTC(), + }, + { + state: connectivity.Shutdown, + target: "test.channelz:8888", + callsStarted: 0, + callsSucceeded: 0, + callsFailed: 0, + }, + {}, + } + channelz.NewChannelzStorage() + for _, c := range tcs { + channelz.RegisterChannel(c, 0, "") + } + s := newCZServer() + resp, _ := s.GetTopChannels(context.Background(), &pb.GetTopChannelsRequest{StartChannelId: 0}) + if !resp.GetEnd() { + t.Fatalf("resp.GetEnd() want true, got %v", resp.GetEnd()) + } + for i, c := range resp.GetChannel() { + if !reflect.DeepEqual(channelProtoToStruct(c), tcs[i]) { + t.Fatalf("dummyChannel: %d, want: %#v, got: %#v", i, tcs[i], channelProtoToStruct(c)) + } + } + for i := 0; i < 50; i++ { + channelz.RegisterChannel(tcs[0], 0, "") + } + resp, _ = s.GetTopChannels(context.Background(), &pb.GetTopChannelsRequest{StartChannelId: 0}) + if resp.GetEnd() { + t.Fatalf("resp.GetEnd() want false, got %v", resp.GetEnd()) + } +} + +func TestGetServers(t *testing.T) { + ss := []*dummyServer{ + { + callsStarted: 6, + callsSucceeded: 2, + callsFailed: 3, + lastCallStartedTimestamp: time.Now().UTC(), + }, + { + callsStarted: 1, + callsSucceeded: 2, + callsFailed: 3, + lastCallStartedTimestamp: time.Now().UTC(), + }, + { + callsStarted: 1, + callsSucceeded: 0, + callsFailed: 0, + lastCallStartedTimestamp: time.Now().UTC(), + }, + } + channelz.NewChannelzStorage() + for _, s := range ss { + channelz.RegisterServer(s, "") + } + svr := newCZServer() + resp, _ := svr.GetServers(context.Background(), &pb.GetServersRequest{StartServerId: 0}) + if !resp.GetEnd() { + t.Fatalf("resp.GetEnd() want true, got %v", resp.GetEnd()) + } + for i, s := range resp.GetServer() { + if !reflect.DeepEqual(serverProtoToStruct(s), ss[i]) { + t.Fatalf("dummyServer: %d, want: %#v, got: %#v", i, ss[i], serverProtoToStruct(s)) + } + } + for i := 0; i < 50; i++ { + channelz.RegisterServer(ss[0], "") + } + resp, _ = svr.GetServers(context.Background(), &pb.GetServersRequest{StartServerId: 0}) + if resp.GetEnd() { + t.Fatalf("resp.GetEnd() want false, got %v", resp.GetEnd()) + } +} + +func TestGetServerSockets(t *testing.T) { + channelz.NewChannelzStorage() + svrID := channelz.RegisterServer(&dummyServer{}, "") + refNames := []string{"listen socket 1", "normal socket 1", "normal socket 2"} + ids := make([]int64, 3) + ids[0] = channelz.RegisterListenSocket(&dummySocket{}, svrID, refNames[0]) + ids[1] = channelz.RegisterNormalSocket(&dummySocket{}, svrID, refNames[1]) + ids[2] = channelz.RegisterNormalSocket(&dummySocket{}, svrID, refNames[2]) + svr := newCZServer() + resp, _ := svr.GetServerSockets(context.Background(), &pb.GetServerSocketsRequest{ServerId: svrID, StartSocketId: 0}) + if !resp.GetEnd() { + t.Fatalf("resp.GetEnd() want: true, got: %v", resp.GetEnd()) + } + // GetServerSockets only return normal sockets. + want := map[int64]string{ + ids[1]: refNames[1], + ids[2]: refNames[2], + } + if !reflect.DeepEqual(convertSocketRefSliceToMap(resp.GetSocketRef()), want) { + t.Fatalf("GetServerSockets want: %#v, got: %#v", want, resp.GetSocketRef()) + } + + for i := 0; i < 50; i++ { + channelz.RegisterNormalSocket(&dummySocket{}, svrID, "") + } + resp, _ = svr.GetServerSockets(context.Background(), &pb.GetServerSocketsRequest{ServerId: svrID, StartSocketId: 0}) + if resp.GetEnd() { + t.Fatalf("resp.GetEnd() want false, got %v", resp.GetEnd()) + } +} + +func TestGetChannel(t *testing.T) { + channelz.NewChannelzStorage() + refNames := []string{"top channel 1", "nested channel 1", "nested channel 2", "nested channel 3"} + ids := make([]int64, 4) + ids[0] = channelz.RegisterChannel(&dummyChannel{}, 0, refNames[0]) + ids[1] = channelz.RegisterChannel(&dummyChannel{}, ids[0], refNames[1]) + ids[2] = channelz.RegisterSubChannel(&dummyChannel{}, ids[0], refNames[2]) + ids[3] = channelz.RegisterChannel(&dummyChannel{}, ids[1], refNames[3]) + svr := newCZServer() + resp, _ := svr.GetChannel(context.Background(), &pb.GetChannelRequest{ChannelId: ids[0]}) + metrics := resp.GetChannel() + subChans := metrics.GetSubchannelRef() + if len(subChans) != 1 || subChans[0].GetName() != refNames[2] || subChans[0].GetSubchannelId() != ids[2] { + t.Fatalf("GetSubChannelRef() want %#v, got %#v", []*pb.SubchannelRef{{ids[2], refNames[2]}}, subChans) + } + nestedChans := metrics.GetChannelRef() + if len(nestedChans) != 1 || nestedChans[0].GetName() != refNames[1] || nestedChans[0].GetChannelId() != ids[1] { + t.Fatalf("GetChannelRef() want %#v, got %#v", []*pb.ChannelRef{{ids[1], refNames[1]}}, nestedChans) + } + + resp, _ = svr.GetChannel(context.Background(), &pb.GetChannelRequest{ChannelId: ids[1]}) + metrics = resp.GetChannel() + nestedChans = metrics.GetChannelRef() + if len(nestedChans) != 1 || nestedChans[0].GetName() != refNames[3] || nestedChans[0].GetChannelId() != ids[3] { + t.Fatalf("GetChannelRef() want %#v, got %#v", []*pb.ChannelRef{{ids[3], refNames[3]}}, nestedChans) + } +} + +func TestGetSubChannel(t *testing.T) { + channelz.NewChannelzStorage() + refNames := []string{"top channel 1", "sub channel 1", "socket 1", "socket 2"} + ids := make([]int64, 4) + ids[0] = channelz.RegisterChannel(&dummyChannel{}, 0, refNames[0]) + ids[1] = channelz.RegisterSubChannel(&dummyChannel{}, ids[0], refNames[1]) + ids[2] = channelz.RegisterNormalSocket(&dummySocket{}, ids[1], refNames[2]) + ids[3] = channelz.RegisterNormalSocket(&dummySocket{}, ids[1], refNames[3]) + svr := newCZServer() + resp, _ := svr.GetSubchannel(context.Background(), &pb.GetSubchannelRequest{SubchannelId: ids[1]}) + metrics := resp.GetSubchannel() + want := map[int64]string{ + ids[2]: refNames[2], + ids[3]: refNames[3], + } + if !reflect.DeepEqual(convertSocketRefSliceToMap(metrics.GetSocketRef()), want) { + t.Fatalf("GetSocketRef() want %#v: got: %#v", want, metrics.GetSocketRef()) + } +} + +func TestGetSocket(t *testing.T) { + channelz.NewChannelzStorage() + ss := []*dummySocket{ + { + streamsStarted: 10, + streamsSucceeded: 2, + streamsFailed: 3, + messagesSent: 20, + messagesReceived: 10, + keepAlivesSent: 2, + lastLocalStreamCreatedTimestamp: time.Now().UTC(), + lastRemoteStreamCreatedTimestamp: time.Now().UTC(), + lastMessageSentTimestamp: time.Now().UTC(), + lastMessageReceivedTimestamp: time.Now().UTC(), + localFlowControlWindow: 65536, + remoteFlowControlWindow: 1024, + localAddr: &net.TCPAddr{IP: net.ParseIP("1.0.0.1"), Port: 10001}, + remoteAddr: &net.TCPAddr{IP: net.ParseIP("12.0.0.1"), Port: 10002}, + remoteName: "remote.remote", + }, + { + streamsStarted: 10, + streamsSucceeded: 2, + streamsFailed: 3, + messagesSent: 20, + messagesReceived: 10, + keepAlivesSent: 2, + lastRemoteStreamCreatedTimestamp: time.Now().UTC(), + lastMessageSentTimestamp: time.Now().UTC(), + lastMessageReceivedTimestamp: time.Now().UTC(), + localFlowControlWindow: 65536, + remoteFlowControlWindow: 1024, + localAddr: &net.UnixAddr{Name: "file.path", Net: "unix"}, + remoteAddr: &net.UnixAddr{Name: "another.path", Net: "unix"}, + remoteName: "remote.remote", + }, + { + streamsStarted: 5, + streamsSucceeded: 2, + streamsFailed: 3, + messagesSent: 20, + messagesReceived: 10, + keepAlivesSent: 2, + lastLocalStreamCreatedTimestamp: time.Now().UTC(), + lastMessageSentTimestamp: time.Now().UTC(), + lastMessageReceivedTimestamp: time.Now().UTC(), + localFlowControlWindow: 65536, + remoteFlowControlWindow: 10240, + localAddr: &net.IPAddr{IP: net.ParseIP("1.0.0.1")}, + remoteAddr: &net.IPAddr{IP: net.ParseIP("9.0.0.1")}, + remoteName: "", + }, + { + localAddr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 10001}, + }, + } + svr := newCZServer() + ids := make([]int64, len(ss)) + svrID := channelz.RegisterServer(&dummyServer{}, "") + for i, s := range ss { + ids[i] = channelz.RegisterNormalSocket(s, svrID, strconv.Itoa(i)) + } + for i, s := range ss { + resp, _ := svr.GetSocket(context.Background(), &pb.GetSocketRequest{SocketId: ids[i]}) + metrics := resp.GetSocket() + if !reflect.DeepEqual(metrics.GetRef(), &pb.SocketRef{SocketId: ids[i], Name: strconv.Itoa(i)}) || !reflect.DeepEqual(socketProtoToStruct(metrics), s) { + t.Fatalf("resp.GetSocket() want: metrics.GetRef() = %#v and %#v, got: metrics.GetRef() = %#v and %#v", &pb.SocketRef{SocketId: ids[i], Name: strconv.Itoa(i)}, s, metrics.GetRef(), socketProtoToStruct(metrics)) + } + } +} diff --git a/channelz/service_proto/service.pb.go b/channelz/service_proto/service.pb.go new file mode 100644 index 00000000..b78483e4 --- /dev/null +++ b/channelz/service_proto/service.pb.go @@ -0,0 +1,2205 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: service.proto + +/* +Package grpc_channelz is a generated protocol buffer package. + +It is generated from these files: + service.proto + +It has these top-level messages: + Channel + Subchannel + ChannelConnectivityState + ChannelData + ChannelTrace + ChannelRef + SubchannelRef + SocketRef + ServerRef + Server + ServerData + Socket + SocketData + Address + Security + SocketOption + SocketOptionTimeout + SocketOptionLinger + SocketOptionTcpInfo + GetServersRequest + GetServersResponse + GetServerSocketsRequest + GetServerSocketsResponse + GetTopChannelsRequest + GetTopChannelsResponse + GetChannelRequest + GetChannelResponse + GetSubchannelRequest + GetSubchannelResponse + GetSocketRequest + GetSocketResponse +*/ +package grpc_channelz + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import google_protobuf "github.com/golang/protobuf/ptypes/any" +import google_protobuf1 "github.com/golang/protobuf/ptypes/duration" +import google_protobuf2 "github.com/golang/protobuf/ptypes/timestamp" +import google_protobuf3 "github.com/golang/protobuf/ptypes/wrappers" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type ChannelConnectivityState_State int32 + +const ( + ChannelConnectivityState_UNKNOWN ChannelConnectivityState_State = 0 + ChannelConnectivityState_IDLE ChannelConnectivityState_State = 1 + ChannelConnectivityState_CONNECTING ChannelConnectivityState_State = 2 + ChannelConnectivityState_READY ChannelConnectivityState_State = 3 + ChannelConnectivityState_TRANSIENT_FAILURE ChannelConnectivityState_State = 4 + ChannelConnectivityState_SHUTDOWN ChannelConnectivityState_State = 5 +) + +var ChannelConnectivityState_State_name = map[int32]string{ + 0: "UNKNOWN", + 1: "IDLE", + 2: "CONNECTING", + 3: "READY", + 4: "TRANSIENT_FAILURE", + 5: "SHUTDOWN", +} +var ChannelConnectivityState_State_value = map[string]int32{ + "UNKNOWN": 0, + "IDLE": 1, + "CONNECTING": 2, + "READY": 3, + "TRANSIENT_FAILURE": 4, + "SHUTDOWN": 5, +} + +func (x ChannelConnectivityState_State) String() string { + return proto.EnumName(ChannelConnectivityState_State_name, int32(x)) +} +func (ChannelConnectivityState_State) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{2, 0} +} + +// Channel is a logical grouping of channels, subchannels, and sockets. +type Channel struct { + // The identifier for this channel. + Ref *ChannelRef `protobuf:"bytes,1,opt,name=ref" json:"ref,omitempty"` + // Data specific to this channel. + Data *ChannelData `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` + // There are no ordering guarantees on the order of channel refs. + // There may not be cycles in the ref graph. + // A channel ref may be present in more than one channel or subchannel. + ChannelRef []*ChannelRef `protobuf:"bytes,3,rep,name=channel_ref,json=channelRef" json:"channel_ref,omitempty"` + // At most one of 'channel_ref+subchannel_ref' and 'socket' is set. + // There are no ordering guarantees on the order of subchannel refs. + // There may not be cycles in the ref graph. + // A sub channel ref may be present in more than one channel or subchannel. + SubchannelRef []*SubchannelRef `protobuf:"bytes,4,rep,name=subchannel_ref,json=subchannelRef" json:"subchannel_ref,omitempty"` + // There are no ordering guarantees on the order of sockets. + SocketRef []*SocketRef `protobuf:"bytes,5,rep,name=socket_ref,json=socketRef" json:"socket_ref,omitempty"` +} + +func (m *Channel) Reset() { *m = Channel{} } +func (m *Channel) String() string { return proto.CompactTextString(m) } +func (*Channel) ProtoMessage() {} +func (*Channel) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *Channel) GetRef() *ChannelRef { + if m != nil { + return m.Ref + } + return nil +} + +func (m *Channel) GetData() *ChannelData { + if m != nil { + return m.Data + } + return nil +} + +func (m *Channel) GetChannelRef() []*ChannelRef { + if m != nil { + return m.ChannelRef + } + return nil +} + +func (m *Channel) GetSubchannelRef() []*SubchannelRef { + if m != nil { + return m.SubchannelRef + } + return nil +} + +func (m *Channel) GetSocketRef() []*SocketRef { + if m != nil { + return m.SocketRef + } + return nil +} + +// Subchannel is a logical grouping of channels, subchannels, and sockets. +// A subchannel is load balanced over by it's ancestor +type Subchannel struct { + // The identifier for this channel. + Ref *SubchannelRef `protobuf:"bytes,1,opt,name=ref" json:"ref,omitempty"` + // Data specific to this channel. + Data *ChannelData `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` + // There are no ordering guarantees on the order of channel refs. + // There may not be cycles in the ref graph. + // A channel ref may be present in more than one channel or subchannel. + ChannelRef []*ChannelRef `protobuf:"bytes,3,rep,name=channel_ref,json=channelRef" json:"channel_ref,omitempty"` + // At most one of 'channel_ref+subchannel_ref' and 'socket' is set. + // There are no ordering guarantees on the order of subchannel refs. + // There may not be cycles in the ref graph. + // A sub channel ref may be present in more than one channel or subchannel. + SubchannelRef []*SubchannelRef `protobuf:"bytes,4,rep,name=subchannel_ref,json=subchannelRef" json:"subchannel_ref,omitempty"` + // There are no ordering guarantees on the order of sockets. + SocketRef []*SocketRef `protobuf:"bytes,5,rep,name=socket_ref,json=socketRef" json:"socket_ref,omitempty"` +} + +func (m *Subchannel) Reset() { *m = Subchannel{} } +func (m *Subchannel) String() string { return proto.CompactTextString(m) } +func (*Subchannel) ProtoMessage() {} +func (*Subchannel) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *Subchannel) GetRef() *SubchannelRef { + if m != nil { + return m.Ref + } + return nil +} + +func (m *Subchannel) GetData() *ChannelData { + if m != nil { + return m.Data + } + return nil +} + +func (m *Subchannel) GetChannelRef() []*ChannelRef { + if m != nil { + return m.ChannelRef + } + return nil +} + +func (m *Subchannel) GetSubchannelRef() []*SubchannelRef { + if m != nil { + return m.SubchannelRef + } + return nil +} + +func (m *Subchannel) GetSocketRef() []*SocketRef { + if m != nil { + return m.SocketRef + } + return nil +} + +// These come from the specified states in this document: +// https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md +type ChannelConnectivityState struct { + State ChannelConnectivityState_State `protobuf:"varint,1,opt,name=state,enum=grpc.channelz.ChannelConnectivityState_State" json:"state,omitempty"` +} + +func (m *ChannelConnectivityState) Reset() { *m = ChannelConnectivityState{} } +func (m *ChannelConnectivityState) String() string { return proto.CompactTextString(m) } +func (*ChannelConnectivityState) ProtoMessage() {} +func (*ChannelConnectivityState) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *ChannelConnectivityState) GetState() ChannelConnectivityState_State { + if m != nil { + return m.State + } + return ChannelConnectivityState_UNKNOWN +} + +type ChannelData struct { + State *ChannelConnectivityState `protobuf:"bytes,1,opt,name=state" json:"state,omitempty"` + // The target this channel originally tried to connect to. May be absent + Target string `protobuf:"bytes,2,opt,name=target" json:"target,omitempty"` + Trace *ChannelTrace `protobuf:"bytes,3,opt,name=trace" json:"trace,omitempty"` + // The number of calls started on the channel + CallsStarted int64 `protobuf:"varint,4,opt,name=calls_started,json=callsStarted" json:"calls_started,omitempty"` + // The number of calls that have completed with an OK status + CallsSucceeded int64 `protobuf:"varint,5,opt,name=calls_succeeded,json=callsSucceeded" json:"calls_succeeded,omitempty"` + // The number of calls that have a completed with a non-OK status + CallsFailed int64 `protobuf:"varint,6,opt,name=calls_failed,json=callsFailed" json:"calls_failed,omitempty"` + // The last time a call was started on the channel. + LastCallStartedTimestamp *google_protobuf2.Timestamp `protobuf:"bytes,7,opt,name=last_call_started_timestamp,json=lastCallStartedTimestamp" json:"last_call_started_timestamp,omitempty"` +} + +func (m *ChannelData) Reset() { *m = ChannelData{} } +func (m *ChannelData) String() string { return proto.CompactTextString(m) } +func (*ChannelData) ProtoMessage() {} +func (*ChannelData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *ChannelData) GetState() *ChannelConnectivityState { + if m != nil { + return m.State + } + return nil +} + +func (m *ChannelData) GetTarget() string { + if m != nil { + return m.Target + } + return "" +} + +func (m *ChannelData) GetTrace() *ChannelTrace { + if m != nil { + return m.Trace + } + return nil +} + +func (m *ChannelData) GetCallsStarted() int64 { + if m != nil { + return m.CallsStarted + } + return 0 +} + +func (m *ChannelData) GetCallsSucceeded() int64 { + if m != nil { + return m.CallsSucceeded + } + return 0 +} + +func (m *ChannelData) GetCallsFailed() int64 { + if m != nil { + return m.CallsFailed + } + return 0 +} + +func (m *ChannelData) GetLastCallStartedTimestamp() *google_protobuf2.Timestamp { + if m != nil { + return m.LastCallStartedTimestamp + } + return nil +} + +type ChannelTrace struct { +} + +func (m *ChannelTrace) Reset() { *m = ChannelTrace{} } +func (m *ChannelTrace) String() string { return proto.CompactTextString(m) } +func (*ChannelTrace) ProtoMessage() {} +func (*ChannelTrace) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +type ChannelRef struct { + // The globally unique id for this channel. Must be a positive number. + ChannelId int64 `protobuf:"varint,1,opt,name=channel_id,json=channelId" json:"channel_id,omitempty"` + // An optional name associated with the channel. + Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` +} + +func (m *ChannelRef) Reset() { *m = ChannelRef{} } +func (m *ChannelRef) String() string { return proto.CompactTextString(m) } +func (*ChannelRef) ProtoMessage() {} +func (*ChannelRef) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *ChannelRef) GetChannelId() int64 { + if m != nil { + return m.ChannelId + } + return 0 +} + +func (m *ChannelRef) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type SubchannelRef struct { + // The globally unique id for this subchannel. Must be a positive number. + SubchannelId int64 `protobuf:"varint,7,opt,name=subchannel_id,json=subchannelId" json:"subchannel_id,omitempty"` + // An optional name associated with the subchannel. + Name string `protobuf:"bytes,8,opt,name=name" json:"name,omitempty"` +} + +func (m *SubchannelRef) Reset() { *m = SubchannelRef{} } +func (m *SubchannelRef) String() string { return proto.CompactTextString(m) } +func (*SubchannelRef) ProtoMessage() {} +func (*SubchannelRef) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *SubchannelRef) GetSubchannelId() int64 { + if m != nil { + return m.SubchannelId + } + return 0 +} + +func (m *SubchannelRef) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type SocketRef struct { + SocketId int64 `protobuf:"varint,3,opt,name=socket_id,json=socketId" json:"socket_id,omitempty"` + // An optional name associated with the socket. + Name string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"` +} + +func (m *SocketRef) Reset() { *m = SocketRef{} } +func (m *SocketRef) String() string { return proto.CompactTextString(m) } +func (*SocketRef) ProtoMessage() {} +func (*SocketRef) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *SocketRef) GetSocketId() int64 { + if m != nil { + return m.SocketId + } + return 0 +} + +func (m *SocketRef) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type ServerRef struct { + // A globally unique identifier for this server. Must be a positive number. + ServerId int64 `protobuf:"varint,5,opt,name=server_id,json=serverId" json:"server_id,omitempty"` + // An optional name associated with the server. + Name string `protobuf:"bytes,6,opt,name=name" json:"name,omitempty"` +} + +func (m *ServerRef) Reset() { *m = ServerRef{} } +func (m *ServerRef) String() string { return proto.CompactTextString(m) } +func (*ServerRef) ProtoMessage() {} +func (*ServerRef) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *ServerRef) GetServerId() int64 { + if m != nil { + return m.ServerId + } + return 0 +} + +func (m *ServerRef) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type Server struct { + Ref *ServerRef `protobuf:"bytes,1,opt,name=ref" json:"ref,omitempty"` + Data *ServerData `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` + // The sockets that the server is listening on. There are no ordering + // guarantees. + ListenSocket []*SocketRef `protobuf:"bytes,3,rep,name=listen_socket,json=listenSocket" json:"listen_socket,omitempty"` +} + +func (m *Server) Reset() { *m = Server{} } +func (m *Server) String() string { return proto.CompactTextString(m) } +func (*Server) ProtoMessage() {} +func (*Server) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *Server) GetRef() *ServerRef { + if m != nil { + return m.Ref + } + return nil +} + +func (m *Server) GetData() *ServerData { + if m != nil { + return m.Data + } + return nil +} + +func (m *Server) GetListenSocket() []*SocketRef { + if m != nil { + return m.ListenSocket + } + return nil +} + +type ServerData struct { + Trace *ChannelTrace `protobuf:"bytes,1,opt,name=trace" json:"trace,omitempty"` + // The number of incoming calls started on the server + CallsStarted int64 `protobuf:"varint,2,opt,name=calls_started,json=callsStarted" json:"calls_started,omitempty"` + // The number of incoming calls that have completed with an OK status + CallsSucceeded int64 `protobuf:"varint,3,opt,name=calls_succeeded,json=callsSucceeded" json:"calls_succeeded,omitempty"` + // The number of incoming calls that have a completed with a non-OK status + CallsFailed int64 `protobuf:"varint,4,opt,name=calls_failed,json=callsFailed" json:"calls_failed,omitempty"` + // The last time a call was started on the server. + LastCallStartedTimestamp *google_protobuf2.Timestamp `protobuf:"bytes,5,opt,name=last_call_started_timestamp,json=lastCallStartedTimestamp" json:"last_call_started_timestamp,omitempty"` +} + +func (m *ServerData) Reset() { *m = ServerData{} } +func (m *ServerData) String() string { return proto.CompactTextString(m) } +func (*ServerData) ProtoMessage() {} +func (*ServerData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +func (m *ServerData) GetTrace() *ChannelTrace { + if m != nil { + return m.Trace + } + return nil +} + +func (m *ServerData) GetCallsStarted() int64 { + if m != nil { + return m.CallsStarted + } + return 0 +} + +func (m *ServerData) GetCallsSucceeded() int64 { + if m != nil { + return m.CallsSucceeded + } + return 0 +} + +func (m *ServerData) GetCallsFailed() int64 { + if m != nil { + return m.CallsFailed + } + return 0 +} + +func (m *ServerData) GetLastCallStartedTimestamp() *google_protobuf2.Timestamp { + if m != nil { + return m.LastCallStartedTimestamp + } + return nil +} + +// Information about an actual connection. Pronounced "sock-ay". +type Socket struct { + Ref *SocketRef `protobuf:"bytes,1,opt,name=ref" json:"ref,omitempty"` + Data *SocketData `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` + // The locally bound address. + Local *Address `protobuf:"bytes,3,opt,name=local" json:"local,omitempty"` + // The remote bound address. May be absent. + Remote *Address `protobuf:"bytes,4,opt,name=remote" json:"remote,omitempty"` + Security *Security `protobuf:"bytes,5,opt,name=security" json:"security,omitempty"` + // Optional, represents the name of the remote endpoint, if different than + // the original target name. + RemoteName string `protobuf:"bytes,6,opt,name=remote_name,json=remoteName" json:"remote_name,omitempty"` +} + +func (m *Socket) Reset() { *m = Socket{} } +func (m *Socket) String() string { return proto.CompactTextString(m) } +func (*Socket) ProtoMessage() {} +func (*Socket) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *Socket) GetRef() *SocketRef { + if m != nil { + return m.Ref + } + return nil +} + +func (m *Socket) GetData() *SocketData { + if m != nil { + return m.Data + } + return nil +} + +func (m *Socket) GetLocal() *Address { + if m != nil { + return m.Local + } + return nil +} + +func (m *Socket) GetRemote() *Address { + if m != nil { + return m.Remote + } + return nil +} + +func (m *Socket) GetSecurity() *Security { + if m != nil { + return m.Security + } + return nil +} + +func (m *Socket) GetRemoteName() string { + if m != nil { + return m.RemoteName + } + return "" +} + +type SocketData struct { + // The number of streams that have been started. + StreamsStarted int64 `protobuf:"varint,1,opt,name=streams_started,json=streamsStarted" json:"streams_started,omitempty"` + // The number of streams that have ended successfully: + // On client side, received frame with eos bit set; + // On server side, sent frame with eos bit set. + StreamsSucceeded int64 `protobuf:"varint,2,opt,name=streams_succeeded,json=streamsSucceeded" json:"streams_succeeded,omitempty"` + // The number of streams that have ended unsuccessfully: + // On client side, ended without receiving frame with eos bit set; + // On server side, ended without sending frame with eos bit set. + StreamsFailed int64 `protobuf:"varint,3,opt,name=streams_failed,json=streamsFailed" json:"streams_failed,omitempty"` + // The number of messages successfully sent on this socket. + MessagesSent int64 `protobuf:"varint,4,opt,name=messages_sent,json=messagesSent" json:"messages_sent,omitempty"` + MessagesReceived int64 `protobuf:"varint,5,opt,name=messages_received,json=messagesReceived" json:"messages_received,omitempty"` + // The number of keep alives sent. This is typically implemented with HTTP/2 + // ping messages. + KeepAlivesSent int64 `protobuf:"varint,6,opt,name=keep_alives_sent,json=keepAlivesSent" json:"keep_alives_sent,omitempty"` + // The last time a stream was created by this endpoint. Usually unset for + // servers. + LastLocalStreamCreatedTimestamp *google_protobuf2.Timestamp `protobuf:"bytes,7,opt,name=last_local_stream_created_timestamp,json=lastLocalStreamCreatedTimestamp" json:"last_local_stream_created_timestamp,omitempty"` + // The last time a stream was created by the remote endpoint. Usually unset + // for clients. + LastRemoteStreamCreatedTimestamp *google_protobuf2.Timestamp `protobuf:"bytes,8,opt,name=last_remote_stream_created_timestamp,json=lastRemoteStreamCreatedTimestamp" json:"last_remote_stream_created_timestamp,omitempty"` + // The last time a message was sent by this endpoint. + LastMessageSentTimestamp *google_protobuf2.Timestamp `protobuf:"bytes,9,opt,name=last_message_sent_timestamp,json=lastMessageSentTimestamp" json:"last_message_sent_timestamp,omitempty"` + // The last time a message was received by this endpoint. + LastMessageReceivedTimestamp *google_protobuf2.Timestamp `protobuf:"bytes,10,opt,name=last_message_received_timestamp,json=lastMessageReceivedTimestamp" json:"last_message_received_timestamp,omitempty"` + // The amount of window, granted to the local endpoint by the remote endpoint. + // This may be slightly out of date due to network latency. This does NOT + // include stream level or TCP level flow control info. + LocalFlowControlWindow *google_protobuf3.Int64Value `protobuf:"bytes,11,opt,name=local_flow_control_window,json=localFlowControlWindow" json:"local_flow_control_window,omitempty"` + // The amount of window, granted to the remote endpoint by the local endpoint. + // This may be slightly out of date due to network latency. This does NOT + // include stream level or TCP level flow control info. + RemoteFlowControlWindow *google_protobuf3.Int64Value `protobuf:"bytes,12,opt,name=remote_flow_control_window,json=remoteFlowControlWindow" json:"remote_flow_control_window,omitempty"` + Option []*SocketOption `protobuf:"bytes,13,rep,name=option" json:"option,omitempty"` +} + +func (m *SocketData) Reset() { *m = SocketData{} } +func (m *SocketData) String() string { return proto.CompactTextString(m) } +func (*SocketData) ProtoMessage() {} +func (*SocketData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } + +func (m *SocketData) GetStreamsStarted() int64 { + if m != nil { + return m.StreamsStarted + } + return 0 +} + +func (m *SocketData) GetStreamsSucceeded() int64 { + if m != nil { + return m.StreamsSucceeded + } + return 0 +} + +func (m *SocketData) GetStreamsFailed() int64 { + if m != nil { + return m.StreamsFailed + } + return 0 +} + +func (m *SocketData) GetMessagesSent() int64 { + if m != nil { + return m.MessagesSent + } + return 0 +} + +func (m *SocketData) GetMessagesReceived() int64 { + if m != nil { + return m.MessagesReceived + } + return 0 +} + +func (m *SocketData) GetKeepAlivesSent() int64 { + if m != nil { + return m.KeepAlivesSent + } + return 0 +} + +func (m *SocketData) GetLastLocalStreamCreatedTimestamp() *google_protobuf2.Timestamp { + if m != nil { + return m.LastLocalStreamCreatedTimestamp + } + return nil +} + +func (m *SocketData) GetLastRemoteStreamCreatedTimestamp() *google_protobuf2.Timestamp { + if m != nil { + return m.LastRemoteStreamCreatedTimestamp + } + return nil +} + +func (m *SocketData) GetLastMessageSentTimestamp() *google_protobuf2.Timestamp { + if m != nil { + return m.LastMessageSentTimestamp + } + return nil +} + +func (m *SocketData) GetLastMessageReceivedTimestamp() *google_protobuf2.Timestamp { + if m != nil { + return m.LastMessageReceivedTimestamp + } + return nil +} + +func (m *SocketData) GetLocalFlowControlWindow() *google_protobuf3.Int64Value { + if m != nil { + return m.LocalFlowControlWindow + } + return nil +} + +func (m *SocketData) GetRemoteFlowControlWindow() *google_protobuf3.Int64Value { + if m != nil { + return m.RemoteFlowControlWindow + } + return nil +} + +func (m *SocketData) GetOption() []*SocketOption { + if m != nil { + return m.Option + } + return nil +} + +type Address struct { + // Types that are valid to be assigned to Address: + // *Address_TcpipAddress + // *Address_UdsAddress_ + // *Address_OtherAddress_ + Address isAddress_Address `protobuf_oneof:"address"` +} + +func (m *Address) Reset() { *m = Address{} } +func (m *Address) String() string { return proto.CompactTextString(m) } +func (*Address) ProtoMessage() {} +func (*Address) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } + +type isAddress_Address interface { + isAddress_Address() +} + +type Address_TcpipAddress struct { + TcpipAddress *Address_TcpIpAddress `protobuf:"bytes,1,opt,name=tcpip_address,json=tcpipAddress,oneof"` +} +type Address_UdsAddress_ struct { + UdsAddress *Address_UdsAddress `protobuf:"bytes,2,opt,name=uds_address,json=udsAddress,oneof"` +} +type Address_OtherAddress_ struct { + OtherAddress *Address_OtherAddress `protobuf:"bytes,3,opt,name=other_address,json=otherAddress,oneof"` +} + +func (*Address_TcpipAddress) isAddress_Address() {} +func (*Address_UdsAddress_) isAddress_Address() {} +func (*Address_OtherAddress_) isAddress_Address() {} + +func (m *Address) GetAddress() isAddress_Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *Address) GetTcpipAddress() *Address_TcpIpAddress { + if x, ok := m.GetAddress().(*Address_TcpipAddress); ok { + return x.TcpipAddress + } + return nil +} + +func (m *Address) GetUdsAddress() *Address_UdsAddress { + if x, ok := m.GetAddress().(*Address_UdsAddress_); ok { + return x.UdsAddress + } + return nil +} + +func (m *Address) GetOtherAddress() *Address_OtherAddress { + if x, ok := m.GetAddress().(*Address_OtherAddress_); ok { + return x.OtherAddress + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Address) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Address_OneofMarshaler, _Address_OneofUnmarshaler, _Address_OneofSizer, []interface{}{ + (*Address_TcpipAddress)(nil), + (*Address_UdsAddress_)(nil), + (*Address_OtherAddress_)(nil), + } +} + +func _Address_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Address) + // address + switch x := m.Address.(type) { + case *Address_TcpipAddress: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.TcpipAddress); err != nil { + return err + } + case *Address_UdsAddress_: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.UdsAddress); err != nil { + return err + } + case *Address_OtherAddress_: + b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.OtherAddress); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Address.Address has unexpected type %T", x) + } + return nil +} + +func _Address_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Address) + switch tag { + case 1: // address.tcpip_address + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Address_TcpIpAddress) + err := b.DecodeMessage(msg) + m.Address = &Address_TcpipAddress{msg} + return true, err + case 2: // address.uds_address + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Address_UdsAddress) + err := b.DecodeMessage(msg) + m.Address = &Address_UdsAddress_{msg} + return true, err + case 3: // address.other_address + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Address_OtherAddress) + err := b.DecodeMessage(msg) + m.Address = &Address_OtherAddress_{msg} + return true, err + default: + return false, nil + } +} + +func _Address_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Address) + // address + switch x := m.Address.(type) { + case *Address_TcpipAddress: + s := proto.Size(x.TcpipAddress) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *Address_UdsAddress_: + s := proto.Size(x.UdsAddress) + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *Address_OtherAddress_: + s := proto.Size(x.OtherAddress) + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type Address_TcpIpAddress struct { + // Either the IPv4 or IPv6 address in bytes. Will either be 4 bytes or 16 + // bytes in length. + IpAddress []byte `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` + // 0-64k, or -1 if not appropriate. + Port int32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"` +} + +func (m *Address_TcpIpAddress) Reset() { *m = Address_TcpIpAddress{} } +func (m *Address_TcpIpAddress) String() string { return proto.CompactTextString(m) } +func (*Address_TcpIpAddress) ProtoMessage() {} +func (*Address_TcpIpAddress) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 0} } + +func (m *Address_TcpIpAddress) GetIpAddress() []byte { + if m != nil { + return m.IpAddress + } + return nil +} + +func (m *Address_TcpIpAddress) GetPort() int32 { + if m != nil { + return m.Port + } + return 0 +} + +// A Unix Domain Socket address. +type Address_UdsAddress struct { + Filename string `protobuf:"bytes,1,opt,name=filename" json:"filename,omitempty"` +} + +func (m *Address_UdsAddress) Reset() { *m = Address_UdsAddress{} } +func (m *Address_UdsAddress) String() string { return proto.CompactTextString(m) } +func (*Address_UdsAddress) ProtoMessage() {} +func (*Address_UdsAddress) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 1} } + +func (m *Address_UdsAddress) GetFilename() string { + if m != nil { + return m.Filename + } + return "" +} + +// An address type not included above. +type Address_OtherAddress struct { + // The human readable version of the value. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // The actual address message. + Value *google_protobuf.Any `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` +} + +func (m *Address_OtherAddress) Reset() { *m = Address_OtherAddress{} } +func (m *Address_OtherAddress) String() string { return proto.CompactTextString(m) } +func (*Address_OtherAddress) ProtoMessage() {} +func (*Address_OtherAddress) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 2} } + +func (m *Address_OtherAddress) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Address_OtherAddress) GetValue() *google_protobuf.Any { + if m != nil { + return m.Value + } + return nil +} + +type Security struct { + // Types that are valid to be assigned to Model: + // *Security_Tls_ + // *Security_Other + Model isSecurity_Model `protobuf_oneof:"model"` +} + +func (m *Security) Reset() { *m = Security{} } +func (m *Security) String() string { return proto.CompactTextString(m) } +func (*Security) ProtoMessage() {} +func (*Security) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } + +type isSecurity_Model interface { + isSecurity_Model() +} + +type Security_Tls_ struct { + Tls *Security_Tls `protobuf:"bytes,1,opt,name=tls,oneof"` +} +type Security_Other struct { + Other *Security_OtherSecurity `protobuf:"bytes,2,opt,name=other,oneof"` +} + +func (*Security_Tls_) isSecurity_Model() {} +func (*Security_Other) isSecurity_Model() {} + +func (m *Security) GetModel() isSecurity_Model { + if m != nil { + return m.Model + } + return nil +} + +func (m *Security) GetTls() *Security_Tls { + if x, ok := m.GetModel().(*Security_Tls_); ok { + return x.Tls + } + return nil +} + +func (m *Security) GetOther() *Security_OtherSecurity { + if x, ok := m.GetModel().(*Security_Other); ok { + return x.Other + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Security) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Security_OneofMarshaler, _Security_OneofUnmarshaler, _Security_OneofSizer, []interface{}{ + (*Security_Tls_)(nil), + (*Security_Other)(nil), + } +} + +func _Security_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Security) + // model + switch x := m.Model.(type) { + case *Security_Tls_: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Tls); err != nil { + return err + } + case *Security_Other: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Other); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Security.Model has unexpected type %T", x) + } + return nil +} + +func _Security_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Security) + switch tag { + case 1: // model.tls + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Security_Tls) + err := b.DecodeMessage(msg) + m.Model = &Security_Tls_{msg} + return true, err + case 2: // model.other + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Security_OtherSecurity) + err := b.DecodeMessage(msg) + m.Model = &Security_Other{msg} + return true, err + default: + return false, nil + } +} + +func _Security_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Security) + // model + switch x := m.Model.(type) { + case *Security_Tls_: + s := proto.Size(x.Tls) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *Security_Other: + s := proto.Size(x.Other) + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type Security_Tls struct { + // Types that are valid to be assigned to CipherSuite: + // *Security_Tls_StandardName + // *Security_Tls_OtherName + CipherSuite isSecurity_Tls_CipherSuite `protobuf_oneof:"cipher_suite"` + // the certificate used by this endpoint. + LocalCertificate []byte `protobuf:"bytes,3,opt,name=local_certificate,json=localCertificate,proto3" json:"local_certificate,omitempty"` + // the certificate used by the remote endpoint. + RemoteCertificate []byte `protobuf:"bytes,4,opt,name=remote_certificate,json=remoteCertificate,proto3" json:"remote_certificate,omitempty"` +} + +func (m *Security_Tls) Reset() { *m = Security_Tls{} } +func (m *Security_Tls) String() string { return proto.CompactTextString(m) } +func (*Security_Tls) ProtoMessage() {} +func (*Security_Tls) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14, 0} } + +type isSecurity_Tls_CipherSuite interface { + isSecurity_Tls_CipherSuite() +} + +type Security_Tls_StandardName struct { + StandardName string `protobuf:"bytes,1,opt,name=standard_name,json=standardName,oneof"` +} +type Security_Tls_OtherName struct { + OtherName string `protobuf:"bytes,2,opt,name=other_name,json=otherName,oneof"` +} + +func (*Security_Tls_StandardName) isSecurity_Tls_CipherSuite() {} +func (*Security_Tls_OtherName) isSecurity_Tls_CipherSuite() {} + +func (m *Security_Tls) GetCipherSuite() isSecurity_Tls_CipherSuite { + if m != nil { + return m.CipherSuite + } + return nil +} + +func (m *Security_Tls) GetStandardName() string { + if x, ok := m.GetCipherSuite().(*Security_Tls_StandardName); ok { + return x.StandardName + } + return "" +} + +func (m *Security_Tls) GetOtherName() string { + if x, ok := m.GetCipherSuite().(*Security_Tls_OtherName); ok { + return x.OtherName + } + return "" +} + +func (m *Security_Tls) GetLocalCertificate() []byte { + if m != nil { + return m.LocalCertificate + } + return nil +} + +func (m *Security_Tls) GetRemoteCertificate() []byte { + if m != nil { + return m.RemoteCertificate + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Security_Tls) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Security_Tls_OneofMarshaler, _Security_Tls_OneofUnmarshaler, _Security_Tls_OneofSizer, []interface{}{ + (*Security_Tls_StandardName)(nil), + (*Security_Tls_OtherName)(nil), + } +} + +func _Security_Tls_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Security_Tls) + // cipher_suite + switch x := m.CipherSuite.(type) { + case *Security_Tls_StandardName: + b.EncodeVarint(1<<3 | proto.WireBytes) + b.EncodeStringBytes(x.StandardName) + case *Security_Tls_OtherName: + b.EncodeVarint(2<<3 | proto.WireBytes) + b.EncodeStringBytes(x.OtherName) + case nil: + default: + return fmt.Errorf("Security_Tls.CipherSuite has unexpected type %T", x) + } + return nil +} + +func _Security_Tls_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Security_Tls) + switch tag { + case 1: // cipher_suite.standard_name + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.CipherSuite = &Security_Tls_StandardName{x} + return true, err + case 2: // cipher_suite.other_name + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.CipherSuite = &Security_Tls_OtherName{x} + return true, err + default: + return false, nil + } +} + +func _Security_Tls_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Security_Tls) + // cipher_suite + switch x := m.CipherSuite.(type) { + case *Security_Tls_StandardName: + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.StandardName))) + n += len(x.StandardName) + case *Security_Tls_OtherName: + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.OtherName))) + n += len(x.OtherName) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type Security_OtherSecurity struct { + // The human readable version of the value. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // The actual security details message. + Value *google_protobuf.Any `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` +} + +func (m *Security_OtherSecurity) Reset() { *m = Security_OtherSecurity{} } +func (m *Security_OtherSecurity) String() string { return proto.CompactTextString(m) } +func (*Security_OtherSecurity) ProtoMessage() {} +func (*Security_OtherSecurity) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14, 1} } + +func (m *Security_OtherSecurity) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Security_OtherSecurity) GetValue() *google_protobuf.Any { + if m != nil { + return m.Value + } + return nil +} + +type SocketOption struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // The human readable value of this socket option. At least one of value or + // additional will be set. + Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + // Additional data associated with the socket option. At least one of value + // or additional will be set. + Additional *google_protobuf.Any `protobuf:"bytes,3,opt,name=additional" json:"additional,omitempty"` +} + +func (m *SocketOption) Reset() { *m = SocketOption{} } +func (m *SocketOption) String() string { return proto.CompactTextString(m) } +func (*SocketOption) ProtoMessage() {} +func (*SocketOption) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } + +func (m *SocketOption) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *SocketOption) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func (m *SocketOption) GetAdditional() *google_protobuf.Any { + if m != nil { + return m.Additional + } + return nil +} + +// For use with SocketOption's additional field. This is primarily used for +// SO_RCVTIMEO and SO_SNDTIMEO +type SocketOptionTimeout struct { + Duration *google_protobuf1.Duration `protobuf:"bytes,1,opt,name=duration" json:"duration,omitempty"` +} + +func (m *SocketOptionTimeout) Reset() { *m = SocketOptionTimeout{} } +func (m *SocketOptionTimeout) String() string { return proto.CompactTextString(m) } +func (*SocketOptionTimeout) ProtoMessage() {} +func (*SocketOptionTimeout) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } + +func (m *SocketOptionTimeout) GetDuration() *google_protobuf1.Duration { + if m != nil { + return m.Duration + } + return nil +} + +type SocketOptionLinger struct { + Active bool `protobuf:"varint,1,opt,name=active" json:"active,omitempty"` + Duration *google_protobuf1.Duration `protobuf:"bytes,2,opt,name=duration" json:"duration,omitempty"` +} + +func (m *SocketOptionLinger) Reset() { *m = SocketOptionLinger{} } +func (m *SocketOptionLinger) String() string { return proto.CompactTextString(m) } +func (*SocketOptionLinger) ProtoMessage() {} +func (*SocketOptionLinger) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } + +func (m *SocketOptionLinger) GetActive() bool { + if m != nil { + return m.Active + } + return false +} + +func (m *SocketOptionLinger) GetDuration() *google_protobuf1.Duration { + if m != nil { + return m.Duration + } + return nil +} + +// Tcp info for SOL_TCP, TCP_INFO +type SocketOptionTcpInfo struct { + TcpiState uint32 `protobuf:"varint,1,opt,name=tcpi_state,json=tcpiState" json:"tcpi_state,omitempty"` + TcpiCaState uint32 `protobuf:"varint,2,opt,name=tcpi_ca_state,json=tcpiCaState" json:"tcpi_ca_state,omitempty"` + TcpiRetransmits uint32 `protobuf:"varint,3,opt,name=tcpi_retransmits,json=tcpiRetransmits" json:"tcpi_retransmits,omitempty"` + TcpiProbes uint32 `protobuf:"varint,4,opt,name=tcpi_probes,json=tcpiProbes" json:"tcpi_probes,omitempty"` + TcpiBackoff uint32 `protobuf:"varint,5,opt,name=tcpi_backoff,json=tcpiBackoff" json:"tcpi_backoff,omitempty"` + TcpiOptions uint32 `protobuf:"varint,6,opt,name=tcpi_options,json=tcpiOptions" json:"tcpi_options,omitempty"` + TcpiSndWscale uint32 `protobuf:"varint,7,opt,name=tcpi_snd_wscale,json=tcpiSndWscale" json:"tcpi_snd_wscale,omitempty"` + TcpiRcvWscale uint32 `protobuf:"varint,8,opt,name=tcpi_rcv_wscale,json=tcpiRcvWscale" json:"tcpi_rcv_wscale,omitempty"` + TcpiRto uint32 `protobuf:"varint,9,opt,name=tcpi_rto,json=tcpiRto" json:"tcpi_rto,omitempty"` + TcpiAto uint32 `protobuf:"varint,10,opt,name=tcpi_ato,json=tcpiAto" json:"tcpi_ato,omitempty"` + TcpiSndMss uint32 `protobuf:"varint,11,opt,name=tcpi_snd_mss,json=tcpiSndMss" json:"tcpi_snd_mss,omitempty"` + TcpiRcvMss uint32 `protobuf:"varint,12,opt,name=tcpi_rcv_mss,json=tcpiRcvMss" json:"tcpi_rcv_mss,omitempty"` + TcpiUnacked uint32 `protobuf:"varint,13,opt,name=tcpi_unacked,json=tcpiUnacked" json:"tcpi_unacked,omitempty"` + TcpiSacked uint32 `protobuf:"varint,14,opt,name=tcpi_sacked,json=tcpiSacked" json:"tcpi_sacked,omitempty"` + TcpiLost uint32 `protobuf:"varint,15,opt,name=tcpi_lost,json=tcpiLost" json:"tcpi_lost,omitempty"` + TcpiRetrans uint32 `protobuf:"varint,16,opt,name=tcpi_retrans,json=tcpiRetrans" json:"tcpi_retrans,omitempty"` + TcpiFackets uint32 `protobuf:"varint,17,opt,name=tcpi_fackets,json=tcpiFackets" json:"tcpi_fackets,omitempty"` + TcpiLastDataSent uint32 `protobuf:"varint,18,opt,name=tcpi_last_data_sent,json=tcpiLastDataSent" json:"tcpi_last_data_sent,omitempty"` + TcpiLastAckSent uint32 `protobuf:"varint,19,opt,name=tcpi_last_ack_sent,json=tcpiLastAckSent" json:"tcpi_last_ack_sent,omitempty"` + TcpiLastDataRecv uint32 `protobuf:"varint,20,opt,name=tcpi_last_data_recv,json=tcpiLastDataRecv" json:"tcpi_last_data_recv,omitempty"` + TcpiLastAckRecv uint32 `protobuf:"varint,21,opt,name=tcpi_last_ack_recv,json=tcpiLastAckRecv" json:"tcpi_last_ack_recv,omitempty"` + TcpiPmtu uint32 `protobuf:"varint,22,opt,name=tcpi_pmtu,json=tcpiPmtu" json:"tcpi_pmtu,omitempty"` + TcpiRcvSsthresh uint32 `protobuf:"varint,23,opt,name=tcpi_rcv_ssthresh,json=tcpiRcvSsthresh" json:"tcpi_rcv_ssthresh,omitempty"` + TcpiRtt uint32 `protobuf:"varint,24,opt,name=tcpi_rtt,json=tcpiRtt" json:"tcpi_rtt,omitempty"` + TcpiRttvar uint32 `protobuf:"varint,25,opt,name=tcpi_rttvar,json=tcpiRttvar" json:"tcpi_rttvar,omitempty"` + TcpiSndSsthresh uint32 `protobuf:"varint,26,opt,name=tcpi_snd_ssthresh,json=tcpiSndSsthresh" json:"tcpi_snd_ssthresh,omitempty"` + TcpiSndCwnd uint32 `protobuf:"varint,27,opt,name=tcpi_snd_cwnd,json=tcpiSndCwnd" json:"tcpi_snd_cwnd,omitempty"` + TcpiAdvmss uint32 `protobuf:"varint,28,opt,name=tcpi_advmss,json=tcpiAdvmss" json:"tcpi_advmss,omitempty"` + TcpiReordering uint32 `protobuf:"varint,29,opt,name=tcpi_reordering,json=tcpiReordering" json:"tcpi_reordering,omitempty"` +} + +func (m *SocketOptionTcpInfo) Reset() { *m = SocketOptionTcpInfo{} } +func (m *SocketOptionTcpInfo) String() string { return proto.CompactTextString(m) } +func (*SocketOptionTcpInfo) ProtoMessage() {} +func (*SocketOptionTcpInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } + +func (m *SocketOptionTcpInfo) GetTcpiState() uint32 { + if m != nil { + return m.TcpiState + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiCaState() uint32 { + if m != nil { + return m.TcpiCaState + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRetransmits() uint32 { + if m != nil { + return m.TcpiRetransmits + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiProbes() uint32 { + if m != nil { + return m.TcpiProbes + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiBackoff() uint32 { + if m != nil { + return m.TcpiBackoff + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiOptions() uint32 { + if m != nil { + return m.TcpiOptions + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiSndWscale() uint32 { + if m != nil { + return m.TcpiSndWscale + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRcvWscale() uint32 { + if m != nil { + return m.TcpiRcvWscale + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRto() uint32 { + if m != nil { + return m.TcpiRto + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiAto() uint32 { + if m != nil { + return m.TcpiAto + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiSndMss() uint32 { + if m != nil { + return m.TcpiSndMss + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRcvMss() uint32 { + if m != nil { + return m.TcpiRcvMss + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiUnacked() uint32 { + if m != nil { + return m.TcpiUnacked + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiSacked() uint32 { + if m != nil { + return m.TcpiSacked + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiLost() uint32 { + if m != nil { + return m.TcpiLost + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRetrans() uint32 { + if m != nil { + return m.TcpiRetrans + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiFackets() uint32 { + if m != nil { + return m.TcpiFackets + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiLastDataSent() uint32 { + if m != nil { + return m.TcpiLastDataSent + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiLastAckSent() uint32 { + if m != nil { + return m.TcpiLastAckSent + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiLastDataRecv() uint32 { + if m != nil { + return m.TcpiLastDataRecv + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiLastAckRecv() uint32 { + if m != nil { + return m.TcpiLastAckRecv + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiPmtu() uint32 { + if m != nil { + return m.TcpiPmtu + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRcvSsthresh() uint32 { + if m != nil { + return m.TcpiRcvSsthresh + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRtt() uint32 { + if m != nil { + return m.TcpiRtt + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiRttvar() uint32 { + if m != nil { + return m.TcpiRttvar + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiSndSsthresh() uint32 { + if m != nil { + return m.TcpiSndSsthresh + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiSndCwnd() uint32 { + if m != nil { + return m.TcpiSndCwnd + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiAdvmss() uint32 { + if m != nil { + return m.TcpiAdvmss + } + return 0 +} + +func (m *SocketOptionTcpInfo) GetTcpiReordering() uint32 { + if m != nil { + return m.TcpiReordering + } + return 0 +} + +type GetServersRequest struct { + // start_server_id indicates that only servers at or above this id should be + // included in the results. + StartServerId int64 `protobuf:"varint,1,opt,name=start_server_id,json=startServerId" json:"start_server_id,omitempty"` +} + +func (m *GetServersRequest) Reset() { *m = GetServersRequest{} } +func (m *GetServersRequest) String() string { return proto.CompactTextString(m) } +func (*GetServersRequest) ProtoMessage() {} +func (*GetServersRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } + +func (m *GetServersRequest) GetStartServerId() int64 { + if m != nil { + return m.StartServerId + } + return 0 +} + +type GetServersResponse struct { + // list of servers that the connection detail service knows about. Sorted in + // ascending server_id order. + Server []*Server `protobuf:"bytes,1,rep,name=server" json:"server,omitempty"` + // If set, indicates that the list of servers is the final list. Requesting + // more servers will only return more if they are created after this RPC + // completes. + End bool `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` +} + +func (m *GetServersResponse) Reset() { *m = GetServersResponse{} } +func (m *GetServersResponse) String() string { return proto.CompactTextString(m) } +func (*GetServersResponse) ProtoMessage() {} +func (*GetServersResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } + +func (m *GetServersResponse) GetServer() []*Server { + if m != nil { + return m.Server + } + return nil +} + +func (m *GetServersResponse) GetEnd() bool { + if m != nil { + return m.End + } + return false +} + +type GetServerSocketsRequest struct { + ServerId int64 `protobuf:"varint,1,opt,name=server_id,json=serverId" json:"server_id,omitempty"` + // start_socket_id indicates that only sockets at or above this id should be + // included in the results. + StartSocketId int64 `protobuf:"varint,2,opt,name=start_socket_id,json=startSocketId" json:"start_socket_id,omitempty"` +} + +func (m *GetServerSocketsRequest) Reset() { *m = GetServerSocketsRequest{} } +func (m *GetServerSocketsRequest) String() string { return proto.CompactTextString(m) } +func (*GetServerSocketsRequest) ProtoMessage() {} +func (*GetServerSocketsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } + +func (m *GetServerSocketsRequest) GetServerId() int64 { + if m != nil { + return m.ServerId + } + return 0 +} + +func (m *GetServerSocketsRequest) GetStartSocketId() int64 { + if m != nil { + return m.StartSocketId + } + return 0 +} + +type GetServerSocketsResponse struct { + // list of socket refs that the connection detail service knows about. Sorted in + // ascending socket_id order. + SocketRef []*SocketRef `protobuf:"bytes,1,rep,name=socket_ref,json=socketRef" json:"socket_ref,omitempty"` + // If set, indicates that the list of sockets is the final list. Requesting + // more sockets will only return more if they are created after this RPC + // completes. + End bool `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` +} + +func (m *GetServerSocketsResponse) Reset() { *m = GetServerSocketsResponse{} } +func (m *GetServerSocketsResponse) String() string { return proto.CompactTextString(m) } +func (*GetServerSocketsResponse) ProtoMessage() {} +func (*GetServerSocketsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } + +func (m *GetServerSocketsResponse) GetSocketRef() []*SocketRef { + if m != nil { + return m.SocketRef + } + return nil +} + +func (m *GetServerSocketsResponse) GetEnd() bool { + if m != nil { + return m.End + } + return false +} + +type GetTopChannelsRequest struct { + // start_channel_id indicates that only channels at or above this id should be + // included in the results. + StartChannelId int64 `protobuf:"varint,1,opt,name=start_channel_id,json=startChannelId" json:"start_channel_id,omitempty"` +} + +func (m *GetTopChannelsRequest) Reset() { *m = GetTopChannelsRequest{} } +func (m *GetTopChannelsRequest) String() string { return proto.CompactTextString(m) } +func (*GetTopChannelsRequest) ProtoMessage() {} +func (*GetTopChannelsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} } + +func (m *GetTopChannelsRequest) GetStartChannelId() int64 { + if m != nil { + return m.StartChannelId + } + return 0 +} + +type GetTopChannelsResponse struct { + // list of channels that the connection detail service knows about. Sorted in + // ascending channel_id order. + Channel []*Channel `protobuf:"bytes,1,rep,name=channel" json:"channel,omitempty"` + // If set, indicates that the list of channels is the final list. Requesting + // more channels can only return more if they are created after this RPC + // completes. + End bool `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` +} + +func (m *GetTopChannelsResponse) Reset() { *m = GetTopChannelsResponse{} } +func (m *GetTopChannelsResponse) String() string { return proto.CompactTextString(m) } +func (*GetTopChannelsResponse) ProtoMessage() {} +func (*GetTopChannelsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} } + +func (m *GetTopChannelsResponse) GetChannel() []*Channel { + if m != nil { + return m.Channel + } + return nil +} + +func (m *GetTopChannelsResponse) GetEnd() bool { + if m != nil { + return m.End + } + return false +} + +type GetChannelRequest struct { + ChannelId int64 `protobuf:"varint,1,opt,name=channel_id,json=channelId" json:"channel_id,omitempty"` +} + +func (m *GetChannelRequest) Reset() { *m = GetChannelRequest{} } +func (m *GetChannelRequest) String() string { return proto.CompactTextString(m) } +func (*GetChannelRequest) ProtoMessage() {} +func (*GetChannelRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} } + +func (m *GetChannelRequest) GetChannelId() int64 { + if m != nil { + return m.ChannelId + } + return 0 +} + +type GetChannelResponse struct { + Channel *Channel `protobuf:"bytes,1,opt,name=channel" json:"channel,omitempty"` +} + +func (m *GetChannelResponse) Reset() { *m = GetChannelResponse{} } +func (m *GetChannelResponse) String() string { return proto.CompactTextString(m) } +func (*GetChannelResponse) ProtoMessage() {} +func (*GetChannelResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} } + +func (m *GetChannelResponse) GetChannel() *Channel { + if m != nil { + return m.Channel + } + return nil +} + +type GetSubchannelRequest struct { + SubchannelId int64 `protobuf:"varint,1,opt,name=subchannel_id,json=subchannelId" json:"subchannel_id,omitempty"` +} + +func (m *GetSubchannelRequest) Reset() { *m = GetSubchannelRequest{} } +func (m *GetSubchannelRequest) String() string { return proto.CompactTextString(m) } +func (*GetSubchannelRequest) ProtoMessage() {} +func (*GetSubchannelRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} } + +func (m *GetSubchannelRequest) GetSubchannelId() int64 { + if m != nil { + return m.SubchannelId + } + return 0 +} + +type GetSubchannelResponse struct { + Subchannel *Subchannel `protobuf:"bytes,1,opt,name=subchannel" json:"subchannel,omitempty"` +} + +func (m *GetSubchannelResponse) Reset() { *m = GetSubchannelResponse{} } +func (m *GetSubchannelResponse) String() string { return proto.CompactTextString(m) } +func (*GetSubchannelResponse) ProtoMessage() {} +func (*GetSubchannelResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} } + +func (m *GetSubchannelResponse) GetSubchannel() *Subchannel { + if m != nil { + return m.Subchannel + } + return nil +} + +type GetSocketRequest struct { + SocketId int64 `protobuf:"varint,1,opt,name=socket_id,json=socketId" json:"socket_id,omitempty"` +} + +func (m *GetSocketRequest) Reset() { *m = GetSocketRequest{} } +func (m *GetSocketRequest) String() string { return proto.CompactTextString(m) } +func (*GetSocketRequest) ProtoMessage() {} +func (*GetSocketRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} } + +func (m *GetSocketRequest) GetSocketId() int64 { + if m != nil { + return m.SocketId + } + return 0 +} + +type GetSocketResponse struct { + Socket *Socket `protobuf:"bytes,1,opt,name=socket" json:"socket,omitempty"` +} + +func (m *GetSocketResponse) Reset() { *m = GetSocketResponse{} } +func (m *GetSocketResponse) String() string { return proto.CompactTextString(m) } +func (*GetSocketResponse) ProtoMessage() {} +func (*GetSocketResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} } + +func (m *GetSocketResponse) GetSocket() *Socket { + if m != nil { + return m.Socket + } + return nil +} + +func init() { + proto.RegisterType((*Channel)(nil), "grpc.channelz.Channel") + proto.RegisterType((*Subchannel)(nil), "grpc.channelz.Subchannel") + proto.RegisterType((*ChannelConnectivityState)(nil), "grpc.channelz.ChannelConnectivityState") + proto.RegisterType((*ChannelData)(nil), "grpc.channelz.ChannelData") + proto.RegisterType((*ChannelTrace)(nil), "grpc.channelz.ChannelTrace") + proto.RegisterType((*ChannelRef)(nil), "grpc.channelz.ChannelRef") + proto.RegisterType((*SubchannelRef)(nil), "grpc.channelz.SubchannelRef") + proto.RegisterType((*SocketRef)(nil), "grpc.channelz.SocketRef") + proto.RegisterType((*ServerRef)(nil), "grpc.channelz.ServerRef") + proto.RegisterType((*Server)(nil), "grpc.channelz.Server") + proto.RegisterType((*ServerData)(nil), "grpc.channelz.ServerData") + proto.RegisterType((*Socket)(nil), "grpc.channelz.Socket") + proto.RegisterType((*SocketData)(nil), "grpc.channelz.SocketData") + proto.RegisterType((*Address)(nil), "grpc.channelz.Address") + proto.RegisterType((*Address_TcpIpAddress)(nil), "grpc.channelz.Address.TcpIpAddress") + proto.RegisterType((*Address_UdsAddress)(nil), "grpc.channelz.Address.UdsAddress") + proto.RegisterType((*Address_OtherAddress)(nil), "grpc.channelz.Address.OtherAddress") + proto.RegisterType((*Security)(nil), "grpc.channelz.Security") + proto.RegisterType((*Security_Tls)(nil), "grpc.channelz.Security.Tls") + proto.RegisterType((*Security_OtherSecurity)(nil), "grpc.channelz.Security.OtherSecurity") + proto.RegisterType((*SocketOption)(nil), "grpc.channelz.SocketOption") + proto.RegisterType((*SocketOptionTimeout)(nil), "grpc.channelz.SocketOptionTimeout") + proto.RegisterType((*SocketOptionLinger)(nil), "grpc.channelz.SocketOptionLinger") + proto.RegisterType((*SocketOptionTcpInfo)(nil), "grpc.channelz.SocketOptionTcpInfo") + proto.RegisterType((*GetServersRequest)(nil), "grpc.channelz.GetServersRequest") + proto.RegisterType((*GetServersResponse)(nil), "grpc.channelz.GetServersResponse") + proto.RegisterType((*GetServerSocketsRequest)(nil), "grpc.channelz.GetServerSocketsRequest") + proto.RegisterType((*GetServerSocketsResponse)(nil), "grpc.channelz.GetServerSocketsResponse") + proto.RegisterType((*GetTopChannelsRequest)(nil), "grpc.channelz.GetTopChannelsRequest") + proto.RegisterType((*GetTopChannelsResponse)(nil), "grpc.channelz.GetTopChannelsResponse") + proto.RegisterType((*GetChannelRequest)(nil), "grpc.channelz.GetChannelRequest") + proto.RegisterType((*GetChannelResponse)(nil), "grpc.channelz.GetChannelResponse") + proto.RegisterType((*GetSubchannelRequest)(nil), "grpc.channelz.GetSubchannelRequest") + proto.RegisterType((*GetSubchannelResponse)(nil), "grpc.channelz.GetSubchannelResponse") + proto.RegisterType((*GetSocketRequest)(nil), "grpc.channelz.GetSocketRequest") + proto.RegisterType((*GetSocketResponse)(nil), "grpc.channelz.GetSocketResponse") + proto.RegisterEnum("grpc.channelz.ChannelConnectivityState_State", ChannelConnectivityState_State_name, ChannelConnectivityState_State_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Channelz service + +type ChannelzClient interface { + // Gets all root channels (e.g. channels the application has directly + // created). This does not include subchannels nor non-top level channels. + GetTopChannels(ctx context.Context, in *GetTopChannelsRequest, opts ...grpc.CallOption) (*GetTopChannelsResponse, error) + // Gets all servers that exist in the process. + GetServers(ctx context.Context, in *GetServersRequest, opts ...grpc.CallOption) (*GetServersResponse, error) + // Gets all server sockets that exist in the process. + GetServerSockets(ctx context.Context, in *GetServerSocketsRequest, opts ...grpc.CallOption) (*GetServerSocketsResponse, error) + // Returns a single Channel, or else a NOT_FOUND code. + GetChannel(ctx context.Context, in *GetChannelRequest, opts ...grpc.CallOption) (*GetChannelResponse, error) + // Returns a single Subchannel, or else a NOT_FOUND code. + GetSubchannel(ctx context.Context, in *GetSubchannelRequest, opts ...grpc.CallOption) (*GetSubchannelResponse, error) + // Returns a single Socket or else a NOT_FOUND code. + GetSocket(ctx context.Context, in *GetSocketRequest, opts ...grpc.CallOption) (*GetSocketResponse, error) +} + +type channelzClient struct { + cc *grpc.ClientConn +} + +func NewChannelzClient(cc *grpc.ClientConn) ChannelzClient { + return &channelzClient{cc} +} + +func (c *channelzClient) GetTopChannels(ctx context.Context, in *GetTopChannelsRequest, opts ...grpc.CallOption) (*GetTopChannelsResponse, error) { + out := new(GetTopChannelsResponse) + err := grpc.Invoke(ctx, "/grpc.channelz.Channelz/GetTopChannels", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *channelzClient) GetServers(ctx context.Context, in *GetServersRequest, opts ...grpc.CallOption) (*GetServersResponse, error) { + out := new(GetServersResponse) + err := grpc.Invoke(ctx, "/grpc.channelz.Channelz/GetServers", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *channelzClient) GetServerSockets(ctx context.Context, in *GetServerSocketsRequest, opts ...grpc.CallOption) (*GetServerSocketsResponse, error) { + out := new(GetServerSocketsResponse) + err := grpc.Invoke(ctx, "/grpc.channelz.Channelz/GetServerSockets", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *channelzClient) GetChannel(ctx context.Context, in *GetChannelRequest, opts ...grpc.CallOption) (*GetChannelResponse, error) { + out := new(GetChannelResponse) + err := grpc.Invoke(ctx, "/grpc.channelz.Channelz/GetChannel", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *channelzClient) GetSubchannel(ctx context.Context, in *GetSubchannelRequest, opts ...grpc.CallOption) (*GetSubchannelResponse, error) { + out := new(GetSubchannelResponse) + err := grpc.Invoke(ctx, "/grpc.channelz.Channelz/GetSubchannel", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *channelzClient) GetSocket(ctx context.Context, in *GetSocketRequest, opts ...grpc.CallOption) (*GetSocketResponse, error) { + out := new(GetSocketResponse) + err := grpc.Invoke(ctx, "/grpc.channelz.Channelz/GetSocket", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Channelz service + +type ChannelzServer interface { + // Gets all root channels (e.g. channels the application has directly + // created). This does not include subchannels nor non-top level channels. + GetTopChannels(context.Context, *GetTopChannelsRequest) (*GetTopChannelsResponse, error) + // Gets all servers that exist in the process. + GetServers(context.Context, *GetServersRequest) (*GetServersResponse, error) + // Gets all server sockets that exist in the process. + GetServerSockets(context.Context, *GetServerSocketsRequest) (*GetServerSocketsResponse, error) + // Returns a single Channel, or else a NOT_FOUND code. + GetChannel(context.Context, *GetChannelRequest) (*GetChannelResponse, error) + // Returns a single Subchannel, or else a NOT_FOUND code. + GetSubchannel(context.Context, *GetSubchannelRequest) (*GetSubchannelResponse, error) + // Returns a single Socket or else a NOT_FOUND code. + GetSocket(context.Context, *GetSocketRequest) (*GetSocketResponse, error) +} + +func RegisterChannelzServer(s *grpc.Server, srv ChannelzServer) { + s.RegisterService(&_Channelz_serviceDesc, srv) +} + +func _Channelz_GetTopChannels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTopChannelsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetTopChannels(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.Channelz/GetTopChannels", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetTopChannels(ctx, req.(*GetTopChannelsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Channelz_GetServers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetServersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetServers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.Channelz/GetServers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetServers(ctx, req.(*GetServersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Channelz_GetServerSockets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetServerSocketsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetServerSockets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.Channelz/GetServerSockets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetServerSockets(ctx, req.(*GetServerSocketsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Channelz_GetChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetChannelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetChannel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.Channelz/GetChannel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetChannel(ctx, req.(*GetChannelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Channelz_GetSubchannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSubchannelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetSubchannel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.Channelz/GetSubchannel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetSubchannel(ctx, req.(*GetSubchannelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Channelz_GetSocket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSocketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChannelzServer).GetSocket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.channelz.Channelz/GetSocket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChannelzServer).GetSocket(ctx, req.(*GetSocketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Channelz_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.channelz.Channelz", + HandlerType: (*ChannelzServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetTopChannels", + Handler: _Channelz_GetTopChannels_Handler, + }, + { + MethodName: "GetServers", + Handler: _Channelz_GetServers_Handler, + }, + { + MethodName: "GetServerSockets", + Handler: _Channelz_GetServerSockets_Handler, + }, + { + MethodName: "GetChannel", + Handler: _Channelz_GetChannel_Handler, + }, + { + MethodName: "GetSubchannel", + Handler: _Channelz_GetSubchannel_Handler, + }, + { + MethodName: "GetSocket", + Handler: _Channelz_GetSocket_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service.proto", +} + +func init() { proto.RegisterFile("service.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 2282 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0x4b, 0x73, 0xdb, 0xc8, + 0x11, 0x36, 0xdf, 0x60, 0x8b, 0xa4, 0xa1, 0xb1, 0x2d, 0x43, 0xd4, 0x6e, 0x24, 0xc3, 0xcf, 0xd8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, 0x1e, 0xab, 0xe9, 0xaf, 0x45, + 0xa8, 0xca, 0xc0, 0x5c, 0x90, 0xb2, 0x2c, 0x9a, 0x97, 0x49, 0x99, 0x00, 0x6b, 0x29, 0xfb, 0x11, + 0x54, 0xc2, 0xd8, 0xc3, 0xa1, 0x6a, 0x59, 0x1b, 0x73, 0xf8, 0xae, 0xef, 0x27, 0x84, 0x52, 0x47, + 0x82, 0x50, 0x07, 0xaa, 0x09, 0x19, 0xc5, 0x4c, 0x96, 0xf8, 0x6a, 0xb8, 0x42, 0xa1, 0x67, 0x60, + 0x50, 0xe2, 0x4d, 0x92, 0x80, 0x7d, 0x50, 0xb1, 0xb8, 0xb9, 0x50, 0x43, 0x72, 0xd8, 0xc9, 0x80, + 0x68, 0x1b, 0xd6, 0xa4, 0xba, 0xab, 0x95, 0x3a, 0x48, 0x51, 0x1f, 0x8f, 0x88, 0xfd, 0xa7, 0x1a, + 0x40, 0x3e, 0x11, 0x9e, 0x4f, 0xca, 0x12, 0x82, 0x47, 0x79, 0xda, 0x65, 0x77, 0x69, 0x29, 0x71, + 0x9a, 0xf8, 0x47, 0xb0, 0x9e, 0x01, 0xb3, 0xd4, 0xcb, 0x0a, 0x31, 0x53, 0x68, 0x96, 0xfc, 0xbb, + 0x90, 0xaa, 0xa7, 0xe9, 0x97, 0x45, 0xd2, 0x54, 0x52, 0x55, 0x00, 0xb7, 0xa1, 0x39, 0x22, 0x94, + 0xe2, 0x13, 0x42, 0x5d, 0x4a, 0x22, 0x96, 0xf6, 0xef, 0x54, 0x38, 0x20, 0x11, 0xe3, 0x86, 0x33, + 0x50, 0x42, 0x3c, 0x12, 0x4c, 0xb3, 0x0e, 0x6e, 0xa6, 0x03, 0x8e, 0x92, 0xa3, 0x07, 0x60, 0x9e, + 0x12, 0x32, 0x76, 0x71, 0x18, 0x4c, 0x53, 0x52, 0xd9, 0xc7, 0x5b, 0x5c, 0xde, 0x15, 0x62, 0x41, + 0xfb, 0x1e, 0x6e, 0x8b, 0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0x6b, 0x3a, 0x75, 0x2e, 0x91, 0xd7, 0x48, 0x5b, 0xb6, 0x24, 0xd7, + 0xc3, 0x0a, 0x51, 0x14, 0x88, 0x35, 0x2e, 0xec, 0x61, 0x89, 0xf9, 0x21, 0x98, 0x02, 0x93, 0x10, + 0x96, 0xe0, 0x88, 0x8e, 0x02, 0x26, 0xfb, 0x44, 0xd3, 0xb9, 0xca, 0xe5, 0x4e, 0x2e, 0xe6, 0x27, + 0x12, 0x01, 0x1d, 0x27, 0xf1, 0x3b, 0x42, 0x45, 0xe9, 0x34, 0x1d, 0xe1, 0xc0, 0x1b, 0x21, 0xe1, + 0x27, 0x45, 0x01, 0x78, 0x87, 0xbd, 0xd3, 0x78, 0x38, 0x14, 0x7b, 0xbb, 0x32, 0xb7, 0x2b, 0x45, + 0x19, 0x44, 0x36, 0x50, 0x2a, 0xb6, 0x74, 0x05, 0x91, 0x53, 0xa3, 0xe8, 0x1e, 0x5c, 0x95, 0x93, + 0x8a, 0x7c, 0xf7, 0x8c, 0x7a, 0x38, 0x24, 0x62, 0xef, 0x6e, 0x3a, 0x62, 0x32, 0x83, 0xc8, 0x7f, + 0x2b, 0x84, 0x19, 0x2e, 0xf1, 0xa6, 0x29, 0xce, 0xc8, 0x71, 0x8e, 0x37, 0x55, 0xb8, 0x4d, 0x30, + 0x24, 0x8e, 0xc5, 0x62, 0xdb, 0x6c, 0x3a, 0x35, 0x01, 0x60, 0x71, 0x36, 0x84, 0x59, 0x2c, 0xb6, + 0x3c, 0x35, 0xd4, 0x65, 0x31, 0xda, 0x51, 0x8e, 0x72, 0x2f, 0x46, 0x94, 0x8a, 0x4d, 0x4b, 0xcd, + 0x76, 0x10, 0xf9, 0x5f, 0x50, 0x9a, 0x21, 0xb8, 0x7d, 0x8e, 0x68, 0xe4, 0x08, 0xc7, 0x9b, 0x72, + 0x44, 0x3a, 0xd9, 0x49, 0x84, 0xbd, 0x53, 0xe2, 0x5b, 0xcd, 0x7c, 0xb2, 0xc7, 0x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 0xf6, 0x9d, + 0xf3, 0x41, 0x8a, 0xbb, 0x0f, 0xf5, 0xac, 0x2c, 0xd0, 0xf6, 0x12, 0x15, 0xbd, 0xc2, 0xda, 0x3b, + 0xab, 0x01, 0x92, 0x6f, 0xf7, 0x1e, 0x5c, 0x0b, 0xe2, 0x39, 0xd4, 0xf4, 0x93, 0xdd, 0x66, 0x5a, + 0x36, 0x6f, 0xf8, 0x89, 0xf0, 0x4d, 0xe1, 0x5d, 0x55, 0x1c, 0x0d, 0x9f, 0xfd, 0x37, 0x00, 0x00, + 0xff, 0xff, 0x9b, 0x15, 0x40, 0x59, 0x67, 0x1b, 0x00, 0x00, +} diff --git a/channelz/service_proto/service.proto b/channelz/service_proto/service.proto new file mode 100644 index 00000000..7b045e29 --- /dev/null +++ b/channelz/service_proto/service.proto @@ -0,0 +1,437 @@ +// Copyright 2018 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file defines an interface for exporting monitoring information +// out of gRPC servers. See the full design at +// https://github.com/grpc/proposal/blob/master/A14-channelz.md + +syntax = "proto3"; + +package grpc.channelz; + +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option java_multiple_files = true; +option java_package = "io.grpc.channelz.v1"; +option java_outer_classname = "ChannelzProto"; + +// Channel is a logical grouping of channels, subchannels, and sockets. +message Channel { + // The identifier for this channel. + ChannelRef ref = 1; + // Data specific to this channel. + ChannelData data = 2; + // At most one of 'channel_ref+subchannel_ref' and 'socket' is set. + + // There are no ordering guarantees on the order of channel refs. + // There may not be cycles in the ref graph. + // A channel ref may be present in more than one channel or subchannel. + repeated ChannelRef channel_ref = 3; + + // At most one of 'channel_ref+subchannel_ref' and 'socket' is set. + // There are no ordering guarantees on the order of subchannel refs. + // There may not be cycles in the ref graph. + // A sub channel ref may be present in more than one channel or subchannel. + repeated SubchannelRef subchannel_ref = 4; + + // There are no ordering guarantees on the order of sockets. + repeated SocketRef socket_ref = 5; +} + +// Subchannel is a logical grouping of channels, subchannels, and sockets. +// A subchannel is load balanced over by it's ancestor +message Subchannel { + // The identifier for this channel. + SubchannelRef ref = 1; + // Data specific to this channel. + ChannelData data = 2; + // At most one of 'channel_ref+subchannel_ref' and 'socket' is set. + + // There are no ordering guarantees on the order of channel refs. + // There may not be cycles in the ref graph. + // A channel ref may be present in more than one channel or subchannel. + repeated ChannelRef channel_ref = 3; + + // At most one of 'channel_ref+subchannel_ref' and 'socket' is set. + // There are no ordering guarantees on the order of subchannel refs. + // There may not be cycles in the ref graph. + // A sub channel ref may be present in more than one channel or subchannel. + repeated SubchannelRef subchannel_ref = 4; + + // There are no ordering guarantees on the order of sockets. + repeated SocketRef socket_ref = 5; +} + +// These come from the specified states in this document: +// https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md +message ChannelConnectivityState { + enum State { + UNKNOWN = 0; + IDLE = 1; + CONNECTING = 2; + READY = 3; + TRANSIENT_FAILURE = 4; + SHUTDOWN = 5; + } + State state = 1; +} + +message ChannelData { + + ChannelConnectivityState state = 1; + + // The target this channel originally tried to connect to. May be absent + string target = 2; + + ChannelTrace trace = 3; + + // The number of calls started on the channel + int64 calls_started = 4; + // The number of calls that have completed with an OK status + int64 calls_succeeded = 5; + // The number of calls that have a completed with a non-OK status + int64 calls_failed = 6; + + // The last time a call was started on the channel. + google.protobuf.Timestamp last_call_started_timestamp = 7; +} + +message ChannelTrace { + // see the proto in the gRFC for channel tracing: + // A3-channel-tracing.md +} + +message ChannelRef { + // The globally unique id for this channel. Must be a positive number. + int64 channel_id = 1; + // An optional name associated with the channel. + string name = 2; + // Intentionally don't use field numbers from other refs. + reserved 3, 4, 5, 6; +} + +message SubchannelRef { + // The globally unique id for this subchannel. Must be a positive number. + int64 subchannel_id = 7; + // An optional name associated with the subchannel. + string name = 8; + // Intentionally don't use field numbers from other refs. + reserved 1, 2, 3, 4, 5, 6; +} + +message SocketRef { + int64 socket_id = 3; + // An optional name associated with the socket. + string name = 4; + // Intentionally don't use field numbers from other refs. + reserved 1, 2, 5, 6, 7, 8; +} + +message ServerRef { + // A globally unique identifier for this server. Must be a positive number. + int64 server_id = 5; + // An optional name associated with the server. + string name = 6; + // Intentionally don't use field numbers from other refs. + reserved 1, 2, 3, 4, 7, 8; +} + +message Server { + ServerRef ref = 1; + ServerData data = 2; + + // The sockets that the server is listening on. There are no ordering + // guarantees. + repeated SocketRef listen_socket = 3; +} + +message ServerData { + ChannelTrace trace = 1; + + // The number of incoming calls started on the server + int64 calls_started = 2; + // The number of incoming calls that have completed with an OK status + int64 calls_succeeded = 3; + // The number of incoming calls that have a completed with a non-OK status + int64 calls_failed = 4; + + // The last time a call was started on the server. + google.protobuf.Timestamp last_call_started_timestamp = 5; +} + +// Information about an actual connection. Pronounced "sock-ay". +message Socket { + SocketRef ref = 1; + + SocketData data = 2; + // The locally bound address. + Address local = 3; + // The remote bound address. May be absent. + Address remote = 4; + Security security = 5; + + // Optional, represents the name of the remote endpoint, if different than + // the original target name. + string remote_name = 6; +} + +message SocketData { + // The number of streams that have been started. + int64 streams_started = 1; + // The number of streams that have ended successfully: + // On client side, received frame with eos bit set; + // On server side, sent frame with eos bit set. + int64 streams_succeeded = 2; + // The number of streams that have ended unsuccessfully: + // On client side, ended without receiving frame with eos bit set; + // On server side, ended without sending frame with eos bit set. + int64 streams_failed = 3; + + // The number of messages successfully sent on this socket. + int64 messages_sent = 4; + int64 messages_received = 5; + + // The number of keep alives sent. This is typically implemented with HTTP/2 + // ping messages. + int64 keep_alives_sent = 6; + + // The last time a stream was created by this endpoint. Usually unset for + // servers. + google.protobuf.Timestamp last_local_stream_created_timestamp = 7; + // The last time a stream was created by the remote endpoint. Usually unset + // for clients. + google.protobuf.Timestamp last_remote_stream_created_timestamp = 8; + + // The last time a message was sent by this endpoint. + google.protobuf.Timestamp last_message_sent_timestamp = 9; + // The last time a message was received by this endpoint. + google.protobuf.Timestamp last_message_received_timestamp = 10; + + // The amount of window, granted to the local endpoint by the remote endpoint. + // This may be slightly out of date due to network latency. This does NOT + // include stream level or TCP level flow control info. + google.protobuf.Int64Value local_flow_control_window = 11; + + // The amount of window, granted to the remote endpoint by the local endpoint. + // This may be slightly out of date due to network latency. This does NOT + // include stream level or TCP level flow control info. + google.protobuf.Int64Value remote_flow_control_window = 12; + + repeated SocketOption option = 13; +} + +message Address { + message TcpIpAddress { + // Either the IPv4 or IPv6 address in bytes. Will either be 4 bytes or 16 + // bytes in length. + bytes ip_address = 1; + // 0-64k, or -1 if not appropriate. + int32 port = 2; + } + // A Unix Domain Socket address. + message UdsAddress { + string filename = 1; + } + // An address type not included above. + message OtherAddress { + // The human readable version of the value. + string name = 1; + // The actual address message. + google.protobuf.Any value = 2; + } + + oneof address { + TcpIpAddress tcpip_address = 1; + UdsAddress uds_address = 2; + OtherAddress other_address = 3; + } +} + +message Security { + message Tls { + oneof cipher_suite { + // The cipher suite name in the RFC 4346 format: + // https://tools.ietf.org/html/rfc4346#appendix-C + string standard_name = 1; + // Some other way to describe the cipher suite if + // the RFC 4346 name is not available. + string other_name = 2; + } + // the certificate used by this endpoint. + bytes local_certificate = 3; + // the certificate used by the remote endpoint. + bytes remote_certificate = 4; + } + message OtherSecurity { + // The human readable version of the value. + string name = 1; + // The actual security details message. + google.protobuf.Any value = 2; + } + oneof model { + Tls tls = 1; + OtherSecurity other = 2; + } +} + +message SocketOption { + string name = 1; + // The human readable value of this socket option. At least one of value or + // additional will be set. + string value = 2; + // Additional data associated with the socket option. At least one of value + // or additional will be set. + google.protobuf.Any additional = 3; +} + +// For use with SocketOption's additional field. This is primarily used for +// SO_RCVTIMEO and SO_SNDTIMEO +message SocketOptionTimeout { + google.protobuf.Duration duration = 1; +} + +message SocketOptionLinger { + bool active = 1; + google.protobuf.Duration duration = 2; +} + +// Tcp info for SOL_TCP, TCP_INFO +message SocketOptionTcpInfo { + uint32 tcpi_state = 1; + + uint32 tcpi_ca_state = 2; + uint32 tcpi_retransmits = 3; + uint32 tcpi_probes = 4; + uint32 tcpi_backoff = 5; + uint32 tcpi_options = 6; + uint32 tcpi_snd_wscale = 7; + uint32 tcpi_rcv_wscale = 8; + + uint32 tcpi_rto = 9; + uint32 tcpi_ato = 10; + uint32 tcpi_snd_mss = 11; + uint32 tcpi_rcv_mss = 12; + + uint32 tcpi_unacked = 13; + uint32 tcpi_sacked = 14; + uint32 tcpi_lost = 15; + uint32 tcpi_retrans = 16; + uint32 tcpi_fackets = 17; + + uint32 tcpi_last_data_sent = 18; + uint32 tcpi_last_ack_sent = 19; + uint32 tcpi_last_data_recv = 20; + uint32 tcpi_last_ack_recv = 21; + + uint32 tcpi_pmtu = 22; + uint32 tcpi_rcv_ssthresh = 23; + uint32 tcpi_rtt = 24; + uint32 tcpi_rttvar = 25; + uint32 tcpi_snd_ssthresh = 26; + uint32 tcpi_snd_cwnd = 27; + uint32 tcpi_advmss = 28; + uint32 tcpi_reordering = 29; +} + +service Channelz { + // Gets all root channels (e.g. channels the application has directly + // created). This does not include subchannels nor non-top level channels. + rpc GetTopChannels(GetTopChannelsRequest) returns (GetTopChannelsResponse); + // Gets all servers that exist in the process. + rpc GetServers(GetServersRequest) returns (GetServersResponse); + // Gets all server sockets that exist in the process. + rpc GetServerSockets(GetServerSocketsRequest) returns (GetServerSocketsResponse); + // Returns a single Channel, or else a NOT_FOUND code. + rpc GetChannel(GetChannelRequest) returns (GetChannelResponse); + // Returns a single Subchannel, or else a NOT_FOUND code. + rpc GetSubchannel(GetSubchannelRequest) returns (GetSubchannelResponse); + // Returns a single Socket or else a NOT_FOUND code. + rpc GetSocket(GetSocketRequest) returns (GetSocketResponse); +} + +message GetServersRequest { + // start_server_id indicates that only servers at or above this id should be + // included in the results. + int64 start_server_id = 1; +} + +message GetServersResponse { + // list of servers that the connection detail service knows about. Sorted in + // ascending server_id order. + repeated Server server = 1; + // If set, indicates that the list of servers is the final list. Requesting + // more servers will only return more if they are created after this RPC + // completes. + bool end = 2; +} + +message GetServerSocketsRequest { + int64 server_id = 1; + // start_socket_id indicates that only sockets at or above this id should be + // included in the results. + int64 start_socket_id = 2; +} + +message GetServerSocketsResponse { + // list of socket refs that the connection detail service knows about. Sorted in + // ascending socket_id order. + repeated SocketRef socket_ref = 1; + // If set, indicates that the list of sockets is the final list. Requesting + // more sockets will only return more if they are created after this RPC + // completes. + bool end = 2; +} + +message GetTopChannelsRequest { + // start_channel_id indicates that only channels at or above this id should be + // included in the results. + int64 start_channel_id = 1; +} + +message GetTopChannelsResponse { + // list of channels that the connection detail service knows about. Sorted in + // ascending channel_id order. + repeated Channel channel = 1; + // If set, indicates that the list of channels is the final list. Requesting + // more channels can only return more if they are created after this RPC + // completes. + bool end = 2; +} + +message GetChannelRequest { + int64 channel_id = 1; +} + +message GetChannelResponse { + Channel channel = 1; +} + +message GetSubchannelRequest { + int64 subchannel_id = 1; +} + +message GetSubchannelResponse { + Subchannel subchannel = 1; +} + +message GetSocketRequest { + int64 socket_id = 1; +} + +message GetSocketResponse { + Socket socket = 1; +}