1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-22 20:06:07 +02:00
opentelemetry-go/example/grpc/api/hello-service.pb.go
Paul Reichelt 6de3dab6b6
Resolve #72 - gRPC Interceptor (#621)
* Move interceptor to plugin

* Add basic net.peer info

* Ensure that grpc status match span status

See: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-rpc.md#status

* Set rpc.service attribute

* Add StreamClientInterceptor and StreamServerInterceptor

* Fix: golint errors

* Apply automated go.mod changes from make

* Implement suggestions to improve readability
2020-04-23 13:07:14 -07:00

355 lines
11 KiB
Go

// Code generated by protoc-gen-go. DO NOT EDIT.
// source: hello-service.proto
/*
Package api is a generated protocol buffer package.
It is generated from these files:
hello-service.proto
It has these top-level messages:
HelloRequest
HelloResponse
*/
package api
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
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 HelloRequest struct {
Greeting string `protobuf:"bytes,1,opt,name=greeting" json:"greeting,omitempty"`
}
func (m *HelloRequest) Reset() { *m = HelloRequest{} }
func (m *HelloRequest) String() string { return proto.CompactTextString(m) }
func (*HelloRequest) ProtoMessage() {}
func (*HelloRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *HelloRequest) GetGreeting() string {
if m != nil {
return m.Greeting
}
return ""
}
type HelloResponse struct {
Reply string `protobuf:"bytes,1,opt,name=reply" json:"reply,omitempty"`
}
func (m *HelloResponse) Reset() { *m = HelloResponse{} }
func (m *HelloResponse) String() string { return proto.CompactTextString(m) }
func (*HelloResponse) ProtoMessage() {}
func (*HelloResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *HelloResponse) GetReply() string {
if m != nil {
return m.Reply
}
return ""
}
func init() {
proto.RegisterType((*HelloRequest)(nil), "api.HelloRequest")
proto.RegisterType((*HelloResponse)(nil), "api.HelloResponse")
}
// 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 HelloService service
type HelloServiceClient interface {
SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error)
SayHelloServerStream(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (HelloService_SayHelloServerStreamClient, error)
SayHelloClientStream(ctx context.Context, opts ...grpc.CallOption) (HelloService_SayHelloClientStreamClient, error)
SayHelloBidiStream(ctx context.Context, opts ...grpc.CallOption) (HelloService_SayHelloBidiStreamClient, error)
}
type helloServiceClient struct {
cc *grpc.ClientConn
}
func NewHelloServiceClient(cc *grpc.ClientConn) HelloServiceClient {
return &helloServiceClient{cc}
}
func (c *helloServiceClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) {
out := new(HelloResponse)
err := grpc.Invoke(ctx, "/api.HelloService/SayHello", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *helloServiceClient) SayHelloServerStream(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (HelloService_SayHelloServerStreamClient, error) {
stream, err := grpc.NewClientStream(ctx, &_HelloService_serviceDesc.Streams[0], c.cc, "/api.HelloService/SayHelloServerStream", opts...)
if err != nil {
return nil, err
}
x := &helloServiceSayHelloServerStreamClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type HelloService_SayHelloServerStreamClient interface {
Recv() (*HelloResponse, error)
grpc.ClientStream
}
type helloServiceSayHelloServerStreamClient struct {
grpc.ClientStream
}
func (x *helloServiceSayHelloServerStreamClient) Recv() (*HelloResponse, error) {
m := new(HelloResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *helloServiceClient) SayHelloClientStream(ctx context.Context, opts ...grpc.CallOption) (HelloService_SayHelloClientStreamClient, error) {
stream, err := grpc.NewClientStream(ctx, &_HelloService_serviceDesc.Streams[1], c.cc, "/api.HelloService/SayHelloClientStream", opts...)
if err != nil {
return nil, err
}
x := &helloServiceSayHelloClientStreamClient{stream}
return x, nil
}
type HelloService_SayHelloClientStreamClient interface {
Send(*HelloRequest) error
CloseAndRecv() (*HelloResponse, error)
grpc.ClientStream
}
type helloServiceSayHelloClientStreamClient struct {
grpc.ClientStream
}
func (x *helloServiceSayHelloClientStreamClient) Send(m *HelloRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *helloServiceSayHelloClientStreamClient) CloseAndRecv() (*HelloResponse, error) {
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
m := new(HelloResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *helloServiceClient) SayHelloBidiStream(ctx context.Context, opts ...grpc.CallOption) (HelloService_SayHelloBidiStreamClient, error) {
stream, err := grpc.NewClientStream(ctx, &_HelloService_serviceDesc.Streams[2], c.cc, "/api.HelloService/SayHelloBidiStream", opts...)
if err != nil {
return nil, err
}
x := &helloServiceSayHelloBidiStreamClient{stream}
return x, nil
}
type HelloService_SayHelloBidiStreamClient interface {
Send(*HelloRequest) error
Recv() (*HelloResponse, error)
grpc.ClientStream
}
type helloServiceSayHelloBidiStreamClient struct {
grpc.ClientStream
}
func (x *helloServiceSayHelloBidiStreamClient) Send(m *HelloRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *helloServiceSayHelloBidiStreamClient) Recv() (*HelloResponse, error) {
m := new(HelloResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// Server API for HelloService service
type HelloServiceServer interface {
SayHello(context.Context, *HelloRequest) (*HelloResponse, error)
SayHelloServerStream(*HelloRequest, HelloService_SayHelloServerStreamServer) error
SayHelloClientStream(HelloService_SayHelloClientStreamServer) error
SayHelloBidiStream(HelloService_SayHelloBidiStreamServer) error
}
func RegisterHelloServiceServer(s *grpc.Server, srv HelloServiceServer) {
s.RegisterService(&_HelloService_serviceDesc, srv)
}
func _HelloService_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HelloRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HelloServiceServer).SayHello(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.HelloService/SayHello",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HelloServiceServer).SayHello(ctx, req.(*HelloRequest))
}
return interceptor(ctx, in, info, handler)
}
func _HelloService_SayHelloServerStream_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(HelloRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(HelloServiceServer).SayHelloServerStream(m, &helloServiceSayHelloServerStreamServer{stream})
}
type HelloService_SayHelloServerStreamServer interface {
Send(*HelloResponse) error
grpc.ServerStream
}
type helloServiceSayHelloServerStreamServer struct {
grpc.ServerStream
}
func (x *helloServiceSayHelloServerStreamServer) Send(m *HelloResponse) error {
return x.ServerStream.SendMsg(m)
}
func _HelloService_SayHelloClientStream_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(HelloServiceServer).SayHelloClientStream(&helloServiceSayHelloClientStreamServer{stream})
}
type HelloService_SayHelloClientStreamServer interface {
SendAndClose(*HelloResponse) error
Recv() (*HelloRequest, error)
grpc.ServerStream
}
type helloServiceSayHelloClientStreamServer struct {
grpc.ServerStream
}
func (x *helloServiceSayHelloClientStreamServer) SendAndClose(m *HelloResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *helloServiceSayHelloClientStreamServer) Recv() (*HelloRequest, error) {
m := new(HelloRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func _HelloService_SayHelloBidiStream_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(HelloServiceServer).SayHelloBidiStream(&helloServiceSayHelloBidiStreamServer{stream})
}
type HelloService_SayHelloBidiStreamServer interface {
Send(*HelloResponse) error
Recv() (*HelloRequest, error)
grpc.ServerStream
}
type helloServiceSayHelloBidiStreamServer struct {
grpc.ServerStream
}
func (x *helloServiceSayHelloBidiStreamServer) Send(m *HelloResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *helloServiceSayHelloBidiStreamServer) Recv() (*HelloRequest, error) {
m := new(HelloRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
var _HelloService_serviceDesc = grpc.ServiceDesc{
ServiceName: "api.HelloService",
HandlerType: (*HelloServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "SayHello",
Handler: _HelloService_SayHello_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "SayHelloServerStream",
Handler: _HelloService_SayHelloServerStream_Handler,
ServerStreams: true,
},
{
StreamName: "SayHelloClientStream",
Handler: _HelloService_SayHelloClientStream_Handler,
ClientStreams: true,
},
{
StreamName: "SayHelloBidiStream",
Handler: _HelloService_SayHelloBidiStream_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "hello-service.proto",
}
func init() { proto.RegisterFile("hello-service.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 192 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xce, 0x48, 0xcd, 0xc9,
0xc9, 0xd7, 0x2d, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,
0x62, 0x4e, 0x2c, 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