add examples/traces (#932)
parent
aab0d5aa43
commit
65d8b48f9a
@ -0,0 +1,30 @@ |
||||
FROM golang:1.15 AS builder |
||||
|
||||
COPY . /src |
||||
|
||||
COPY ../ /src |
||||
|
||||
WORKDIR /src/app/message |
||||
|
||||
RUN GOPROXY=https://goproxy.cn go build -o ./bin/message ./... |
||||
|
||||
WORKDIR /src/app/user |
||||
|
||||
RUN GOPROXY=https://goproxy.cn go build -o ./bin/user ./... |
||||
|
||||
FROM debian:stable-slim |
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \ |
||||
ca-certificates \ |
||||
netbase \ |
||||
&& rm -rf /var/lib/apt/lists/ \ |
||||
&& apt-get autoremove -y && apt-get autoclean -y |
||||
|
||||
COPY --from=builder /src/app/message/bin /app |
||||
COPY --from=builder /src/app/user/bin /app |
||||
COPY --from=builder /src/start.sh /app |
||||
|
||||
EXPOSE 8000 |
||||
EXPOSE 9000 |
||||
|
||||
ENTRYPOINT ["sh","/app/start.sh"] |
@ -0,0 +1,19 @@ |
||||
# traces example |
||||
|
||||
- There are two services in the example |
||||
|
||||
- After receiving the HTTP request, the user service calls the grpc server provided by the message service through the grpc client |
||||
|
||||
- The example shows how to use tracing middleware |
||||
|
||||
- You can experience the effect by following the command |
||||
|
||||
### run example |
||||
```shell |
||||
docker-compose up -build |
||||
curl http://localhost:8000/v1/user/get/message/10 |
||||
# Open with browser http://localhost:16686 |
||||
# You can see the effect |
||||
``` |
||||
|
||||
|
@ -0,0 +1,299 @@ |
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.13.0
|
||||
// source: message.proto
|
||||
|
||||
package v1 |
||||
|
||||
import ( |
||||
_ "google.golang.org/genproto/googleapis/api/annotations" |
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect" |
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl" |
||||
reflect "reflect" |
||||
sync "sync" |
||||
) |
||||
|
||||
const ( |
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) |
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) |
||||
) |
||||
|
||||
type GetUserMessageRequest struct { |
||||
state protoimpl.MessageState |
||||
sizeCache protoimpl.SizeCache |
||||
unknownFields protoimpl.UnknownFields |
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` |
||||
Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` |
||||
} |
||||
|
||||
func (x *GetUserMessageRequest) Reset() { |
||||
*x = GetUserMessageRequest{} |
||||
if protoimpl.UnsafeEnabled { |
||||
mi := &file_message_proto_msgTypes[0] |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
} |
||||
|
||||
func (x *GetUserMessageRequest) String() string { |
||||
return protoimpl.X.MessageStringOf(x) |
||||
} |
||||
|
||||
func (*GetUserMessageRequest) ProtoMessage() {} |
||||
|
||||
func (x *GetUserMessageRequest) ProtoReflect() protoreflect.Message { |
||||
mi := &file_message_proto_msgTypes[0] |
||||
if protoimpl.UnsafeEnabled && x != nil { |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
if ms.LoadMessageInfo() == nil { |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
return ms |
||||
} |
||||
return mi.MessageOf(x) |
||||
} |
||||
|
||||
// Deprecated: Use GetUserMessageRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserMessageRequest) Descriptor() ([]byte, []int) { |
||||
return file_message_proto_rawDescGZIP(), []int{0} |
||||
} |
||||
|
||||
func (x *GetUserMessageRequest) GetId() int64 { |
||||
if x != nil { |
||||
return x.Id |
||||
} |
||||
return 0 |
||||
} |
||||
|
||||
func (x *GetUserMessageRequest) GetCount() int64 { |
||||
if x != nil { |
||||
return x.Count |
||||
} |
||||
return 0 |
||||
} |
||||
|
||||
type GetUserMessageReply struct { |
||||
state protoimpl.MessageState |
||||
sizeCache protoimpl.SizeCache |
||||
unknownFields protoimpl.UnknownFields |
||||
|
||||
Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` |
||||
} |
||||
|
||||
func (x *GetUserMessageReply) Reset() { |
||||
*x = GetUserMessageReply{} |
||||
if protoimpl.UnsafeEnabled { |
||||
mi := &file_message_proto_msgTypes[1] |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
} |
||||
|
||||
func (x *GetUserMessageReply) String() string { |
||||
return protoimpl.X.MessageStringOf(x) |
||||
} |
||||
|
||||
func (*GetUserMessageReply) ProtoMessage() {} |
||||
|
||||
func (x *GetUserMessageReply) ProtoReflect() protoreflect.Message { |
||||
mi := &file_message_proto_msgTypes[1] |
||||
if protoimpl.UnsafeEnabled && x != nil { |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
if ms.LoadMessageInfo() == nil { |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
return ms |
||||
} |
||||
return mi.MessageOf(x) |
||||
} |
||||
|
||||
// Deprecated: Use GetUserMessageReply.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserMessageReply) Descriptor() ([]byte, []int) { |
||||
return file_message_proto_rawDescGZIP(), []int{1} |
||||
} |
||||
|
||||
func (x *GetUserMessageReply) GetMessages() []*Message { |
||||
if x != nil { |
||||
return x.Messages |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
type Message struct { |
||||
state protoimpl.MessageState |
||||
sizeCache protoimpl.SizeCache |
||||
unknownFields protoimpl.UnknownFields |
||||
|
||||
Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` |
||||
} |
||||
|
||||
func (x *Message) Reset() { |
||||
*x = Message{} |
||||
if protoimpl.UnsafeEnabled { |
||||
mi := &file_message_proto_msgTypes[2] |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
} |
||||
|
||||
func (x *Message) String() string { |
||||
return protoimpl.X.MessageStringOf(x) |
||||
} |
||||
|
||||
func (*Message) ProtoMessage() {} |
||||
|
||||
func (x *Message) ProtoReflect() protoreflect.Message { |
||||
mi := &file_message_proto_msgTypes[2] |
||||
if protoimpl.UnsafeEnabled && x != nil { |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
if ms.LoadMessageInfo() == nil { |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
return ms |
||||
} |
||||
return mi.MessageOf(x) |
||||
} |
||||
|
||||
// Deprecated: Use Message.ProtoReflect.Descriptor instead.
|
||||
func (*Message) Descriptor() ([]byte, []int) { |
||||
return file_message_proto_rawDescGZIP(), []int{2} |
||||
} |
||||
|
||||
func (x *Message) GetContent() string { |
||||
if x != nil { |
||||
return x.Content |
||||
} |
||||
return "" |
||||
} |
||||
|
||||
var File_message_proto protoreflect.FileDescriptor |
||||
|
||||
var file_message_proto_rawDesc = []byte{ |
||||
0x0a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, |
||||
0x0e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x1a, |
||||
0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, |
||||
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3d, 0x0a, |
||||
0x15, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, |
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, |
||||
0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, |
||||
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x4a, 0x0a, 0x13, |
||||
0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, |
||||
0x70, 0x6c, 0x79, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, |
||||
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, |
||||
0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, |
||||
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x23, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, |
||||
0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, |
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x32, 0x99, 0x01, |
||||
0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, |
||||
0x12, 0x86, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, |
||||
0x61, 0x67, 0x65, 0x12, 0x25, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, |
||||
0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, |
||||
0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, |
||||
0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, |
||||
0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, |
||||
0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x73, |
||||
0x73, 0x61, 0x67, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x7b, |
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x7d, 0x3a, 0x01, 0x2a, 0x42, 0x51, 0x0a, 0x0e, 0x61, 0x70, 0x69, |
||||
0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x50, 0x01, 0x5a, 0x3d, 0x67, |
||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x6b, 0x72, 0x61, |
||||
0x74, 0x6f, 0x73, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, |
||||
0x6c, 0x65, 0x73, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, |
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, |
||||
0x6f, 0x74, 0x6f, 0x33, |
||||
} |
||||
|
||||
var ( |
||||
file_message_proto_rawDescOnce sync.Once |
||||
file_message_proto_rawDescData = file_message_proto_rawDesc |
||||
) |
||||
|
||||
func file_message_proto_rawDescGZIP() []byte { |
||||
file_message_proto_rawDescOnce.Do(func() { |
||||
file_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_message_proto_rawDescData) |
||||
}) |
||||
return file_message_proto_rawDescData |
||||
} |
||||
|
||||
var file_message_proto_msgTypes = make([]protoimpl.MessageInfo, 3) |
||||
var file_message_proto_goTypes = []interface{}{ |
||||
(*GetUserMessageRequest)(nil), // 0: api.message.v1.GetUserMessageRequest
|
||||
(*GetUserMessageReply)(nil), // 1: api.message.v1.GetUserMessageReply
|
||||
(*Message)(nil), // 2: api.message.v1.Message
|
||||
} |
||||
var file_message_proto_depIdxs = []int32{ |
||||
2, // 0: api.message.v1.GetUserMessageReply.messages:type_name -> api.message.v1.Message
|
||||
0, // 1: api.message.v1.MessageService.GetUserMessage:input_type -> api.message.v1.GetUserMessageRequest
|
||||
1, // 2: api.message.v1.MessageService.GetUserMessage:output_type -> api.message.v1.GetUserMessageReply
|
||||
2, // [2:3] is the sub-list for method output_type
|
||||
1, // [1:2] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
} |
||||
|
||||
func init() { file_message_proto_init() } |
||||
func file_message_proto_init() { |
||||
if File_message_proto != nil { |
||||
return |
||||
} |
||||
if !protoimpl.UnsafeEnabled { |
||||
file_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { |
||||
switch v := v.(*GetUserMessageRequest); i { |
||||
case 0: |
||||
return &v.state |
||||
case 1: |
||||
return &v.sizeCache |
||||
case 2: |
||||
return &v.unknownFields |
||||
default: |
||||
return nil |
||||
} |
||||
} |
||||
file_message_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { |
||||
switch v := v.(*GetUserMessageReply); i { |
||||
case 0: |
||||
return &v.state |
||||
case 1: |
||||
return &v.sizeCache |
||||
case 2: |
||||
return &v.unknownFields |
||||
default: |
||||
return nil |
||||
} |
||||
} |
||||
file_message_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { |
||||
switch v := v.(*Message); i { |
||||
case 0: |
||||
return &v.state |
||||
case 1: |
||||
return &v.sizeCache |
||||
case 2: |
||||
return &v.unknownFields |
||||
default: |
||||
return nil |
||||
} |
||||
} |
||||
} |
||||
type x struct{} |
||||
out := protoimpl.TypeBuilder{ |
||||
File: protoimpl.DescBuilder{ |
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), |
||||
RawDescriptor: file_message_proto_rawDesc, |
||||
NumEnums: 0, |
||||
NumMessages: 3, |
||||
NumExtensions: 0, |
||||
NumServices: 1, |
||||
}, |
||||
GoTypes: file_message_proto_goTypes, |
||||
DependencyIndexes: file_message_proto_depIdxs, |
||||
MessageInfos: file_message_proto_msgTypes, |
||||
}.Build() |
||||
File_message_proto = out.File |
||||
file_message_proto_rawDesc = nil |
||||
file_message_proto_goTypes = nil |
||||
file_message_proto_depIdxs = nil |
||||
} |
@ -0,0 +1,32 @@ |
||||
syntax = "proto3"; |
||||
|
||||
package api.message.v1; |
||||
|
||||
option go_package = "github.com/go-kratos/kratos/examples/traces/api/message/v1;v1"; |
||||
option java_multiple_files = true; |
||||
option java_package = "api.message.v1"; |
||||
|
||||
import "google/api/annotations.proto"; |
||||
|
||||
service MessageService { |
||||
rpc GetUserMessage (GetUserMessageRequest) returns (GetUserMessageReply){ |
||||
option (google.api.http) = { |
||||
get: "/v1/message/user/{id}/{count}" |
||||
body: "*" |
||||
}; |
||||
} |
||||
} |
||||
|
||||
|
||||
message GetUserMessageRequest { |
||||
int64 id = 1; |
||||
int64 count = 2; |
||||
} |
||||
|
||||
message GetUserMessageReply { |
||||
repeated Message messages = 1; |
||||
} |
||||
|
||||
message Message { |
||||
string content = 1; |
||||
} |
@ -0,0 +1,101 @@ |
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package v1 |
||||
|
||||
import ( |
||||
context "context" |
||||
grpc "google.golang.org/grpc" |
||||
codes "google.golang.org/grpc/codes" |
||||
status "google.golang.org/grpc/status" |
||||
) |
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7 |
||||
|
||||
// MessageServiceClient is the client API for MessageService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type MessageServiceClient interface { |
||||
GetUserMessage(ctx context.Context, in *GetUserMessageRequest, opts ...grpc.CallOption) (*GetUserMessageReply, error) |
||||
} |
||||
|
||||
type messageServiceClient struct { |
||||
cc grpc.ClientConnInterface |
||||
} |
||||
|
||||
func NewMessageServiceClient(cc grpc.ClientConnInterface) MessageServiceClient { |
||||
return &messageServiceClient{cc} |
||||
} |
||||
|
||||
func (c *messageServiceClient) GetUserMessage(ctx context.Context, in *GetUserMessageRequest, opts ...grpc.CallOption) (*GetUserMessageReply, error) { |
||||
out := new(GetUserMessageReply) |
||||
err := c.cc.Invoke(ctx, "/api.message.v1.MessageService/GetUserMessage", in, out, opts...) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
return out, nil |
||||
} |
||||
|
||||
// MessageServiceServer is the server API for MessageService service.
|
||||
// All implementations must embed UnimplementedMessageServiceServer
|
||||
// for forward compatibility
|
||||
type MessageServiceServer interface { |
||||
GetUserMessage(context.Context, *GetUserMessageRequest) (*GetUserMessageReply, error) |
||||
mustEmbedUnimplementedMessageServiceServer() |
||||
} |
||||
|
||||
// UnimplementedMessageServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedMessageServiceServer struct { |
||||
} |
||||
|
||||
func (UnimplementedMessageServiceServer) GetUserMessage(context.Context, *GetUserMessageRequest) (*GetUserMessageReply, error) { |
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserMessage not implemented") |
||||
} |
||||
func (UnimplementedMessageServiceServer) mustEmbedUnimplementedMessageServiceServer() {} |
||||
|
||||
// UnsafeMessageServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to MessageServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeMessageServiceServer interface { |
||||
mustEmbedUnimplementedMessageServiceServer() |
||||
} |
||||
|
||||
func RegisterMessageServiceServer(s grpc.ServiceRegistrar, srv MessageServiceServer) { |
||||
s.RegisterService(&MessageService_ServiceDesc, srv) |
||||
} |
||||
|
||||
func _MessageService_GetUserMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |
||||
in := new(GetUserMessageRequest) |
||||
if err := dec(in); err != nil { |
||||
return nil, err |
||||
} |
||||
if interceptor == nil { |
||||
return srv.(MessageServiceServer).GetUserMessage(ctx, in) |
||||
} |
||||
info := &grpc.UnaryServerInfo{ |
||||
Server: srv, |
||||
FullMethod: "/api.message.v1.MessageService/GetUserMessage", |
||||
} |
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) { |
||||
return srv.(MessageServiceServer).GetUserMessage(ctx, req.(*GetUserMessageRequest)) |
||||
} |
||||
return interceptor(ctx, in, info, handler) |
||||
} |
||||
|
||||
// MessageService_ServiceDesc is the grpc.ServiceDesc for MessageService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var MessageService_ServiceDesc = grpc.ServiceDesc{ |
||||
ServiceName: "api.message.v1.MessageService", |
||||
HandlerType: (*MessageServiceServer)(nil), |
||||
Methods: []grpc.MethodDesc{ |
||||
{ |
||||
MethodName: "GetUserMessage", |
||||
Handler: _MessageService_GetUserMessage_Handler, |
||||
}, |
||||
}, |
||||
Streams: []grpc.StreamDesc{}, |
||||
Metadata: "message.proto", |
||||
} |
@ -0,0 +1,63 @@ |
||||
// Code generated by protoc-gen-go-http. DO NOT EDIT.
|
||||
|
||||
package v1 |
||||
|
||||
import ( |
||||
context "context" |
||||
http1 "github.com/go-kratos/kratos/v2/transport/http" |
||||
binding "github.com/go-kratos/kratos/v2/transport/http/binding" |
||||
mux "github.com/gorilla/mux" |
||||
http "net/http" |
||||
) |
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the kratos package it is being compiled against.
|
||||
var _ = new(http.Request) |
||||
var _ = new(context.Context) |
||||
var _ = binding.MapProto |
||||
var _ = mux.NewRouter |
||||
|
||||
const _ = http1.SupportPackageIsVersion1 |
||||
|
||||
type MessageServiceHandler interface { |
||||
GetUserMessage(context.Context, *GetUserMessageRequest) (*GetUserMessageReply, error) |
||||
} |
||||
|
||||
func NewMessageServiceHandler(srv MessageServiceHandler, opts ...http1.HandleOption) http.Handler { |
||||
h := http1.DefaultHandleOptions() |
||||
for _, o := range opts { |
||||
o(&h) |
||||
} |
||||
r := mux.NewRouter() |
||||
|
||||
r.HandleFunc("/v1/message/user/{id}/{count}", func(w http.ResponseWriter, r *http.Request) { |
||||
var in GetUserMessageRequest |
||||
if err := h.Decode(r, &in); err != nil { |
||||
h.Error(w, r, err) |
||||
return |
||||
} |
||||
|
||||
if err := binding.MapProto(&in, mux.Vars(r)); err != nil { |
||||
h.Error(w, r, err) |
||||
return |
||||
} |
||||
|
||||
next := func(ctx context.Context, req interface{}) (interface{}, error) { |
||||
return srv.GetUserMessage(ctx, req.(*GetUserMessageRequest)) |
||||
} |
||||
if h.Middleware != nil { |
||||
next = h.Middleware(next) |
||||
} |
||||
out, err := next(r.Context(), &in) |
||||
if err != nil { |
||||
h.Error(w, r, err) |
||||
return |
||||
} |
||||
reply := out.(*GetUserMessageReply) |
||||
if err := h.Encode(w, r, reply); err != nil { |
||||
h.Error(w, r, err) |
||||
} |
||||
}).Methods("GET") |
||||
|
||||
return r |
||||
} |
@ -0,0 +1,288 @@ |
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.13.0
|
||||
// source: user.proto
|
||||
|
||||
package v1 |
||||
|
||||
import ( |
||||
_ "google.golang.org/genproto/googleapis/api/annotations" |
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect" |
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl" |
||||
reflect "reflect" |
||||
sync "sync" |
||||
) |
||||
|
||||
const ( |
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) |
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) |
||||
) |
||||
|
||||
type GetMyMessagesRequest struct { |
||||
state protoimpl.MessageState |
||||
sizeCache protoimpl.SizeCache |
||||
unknownFields protoimpl.UnknownFields |
||||
|
||||
Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` |
||||
} |
||||
|
||||
func (x *GetMyMessagesRequest) Reset() { |
||||
*x = GetMyMessagesRequest{} |
||||
if protoimpl.UnsafeEnabled { |
||||
mi := &file_user_proto_msgTypes[0] |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
} |
||||
|
||||
func (x *GetMyMessagesRequest) String() string { |
||||
return protoimpl.X.MessageStringOf(x) |
||||
} |
||||
|
||||
func (*GetMyMessagesRequest) ProtoMessage() {} |
||||
|
||||
func (x *GetMyMessagesRequest) ProtoReflect() protoreflect.Message { |
||||
mi := &file_user_proto_msgTypes[0] |
||||
if protoimpl.UnsafeEnabled && x != nil { |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
if ms.LoadMessageInfo() == nil { |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
return ms |
||||
} |
||||
return mi.MessageOf(x) |
||||
} |
||||
|
||||
// Deprecated: Use GetMyMessagesRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetMyMessagesRequest) Descriptor() ([]byte, []int) { |
||||
return file_user_proto_rawDescGZIP(), []int{0} |
||||
} |
||||
|
||||
func (x *GetMyMessagesRequest) GetCount() int64 { |
||||
if x != nil { |
||||
return x.Count |
||||
} |
||||
return 0 |
||||
} |
||||
|
||||
type GetMyMessagesReply struct { |
||||
state protoimpl.MessageState |
||||
sizeCache protoimpl.SizeCache |
||||
unknownFields protoimpl.UnknownFields |
||||
|
||||
Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` |
||||
} |
||||
|
||||
func (x *GetMyMessagesReply) Reset() { |
||||
*x = GetMyMessagesReply{} |
||||
if protoimpl.UnsafeEnabled { |
||||
mi := &file_user_proto_msgTypes[1] |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
} |
||||
|
||||
func (x *GetMyMessagesReply) String() string { |
||||
return protoimpl.X.MessageStringOf(x) |
||||
} |
||||
|
||||
func (*GetMyMessagesReply) ProtoMessage() {} |
||||
|
||||
func (x *GetMyMessagesReply) ProtoReflect() protoreflect.Message { |
||||
mi := &file_user_proto_msgTypes[1] |
||||
if protoimpl.UnsafeEnabled && x != nil { |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
if ms.LoadMessageInfo() == nil { |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
return ms |
||||
} |
||||
return mi.MessageOf(x) |
||||
} |
||||
|
||||
// Deprecated: Use GetMyMessagesReply.ProtoReflect.Descriptor instead.
|
||||
func (*GetMyMessagesReply) Descriptor() ([]byte, []int) { |
||||
return file_user_proto_rawDescGZIP(), []int{1} |
||||
} |
||||
|
||||
func (x *GetMyMessagesReply) GetMessages() []*Message { |
||||
if x != nil { |
||||
return x.Messages |
||||
} |
||||
return nil |
||||
} |
||||
|
||||
type Message struct { |
||||
state protoimpl.MessageState |
||||
sizeCache protoimpl.SizeCache |
||||
unknownFields protoimpl.UnknownFields |
||||
|
||||
Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` |
||||
} |
||||
|
||||
func (x *Message) Reset() { |
||||
*x = Message{} |
||||
if protoimpl.UnsafeEnabled { |
||||
mi := &file_user_proto_msgTypes[2] |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
} |
||||
|
||||
func (x *Message) String() string { |
||||
return protoimpl.X.MessageStringOf(x) |
||||
} |
||||
|
||||
func (*Message) ProtoMessage() {} |
||||
|
||||
func (x *Message) ProtoReflect() protoreflect.Message { |
||||
mi := &file_user_proto_msgTypes[2] |
||||
if protoimpl.UnsafeEnabled && x != nil { |
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
||||
if ms.LoadMessageInfo() == nil { |
||||
ms.StoreMessageInfo(mi) |
||||
} |
||||
return ms |
||||
} |
||||
return mi.MessageOf(x) |
||||
} |
||||
|
||||
// Deprecated: Use Message.ProtoReflect.Descriptor instead.
|
||||
func (*Message) Descriptor() ([]byte, []int) { |
||||
return file_user_proto_rawDescGZIP(), []int{2} |
||||
} |
||||
|
||||
func (x *Message) GetContent() string { |
||||
if x != nil { |
||||
return x.Content |
||||
} |
||||
return "" |
||||
} |
||||
|
||||
var File_user_proto protoreflect.FileDescriptor |
||||
|
||||
var file_user_proto_rawDesc = []byte{ |
||||
0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x61, 0x70, |
||||
0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, |
||||
0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, |
||||
0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4d, 0x79, |
||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, |
||||
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, |
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x46, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x79, 0x4d, 0x65, |
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x30, 0x0a, 0x08, 0x6d, |
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, |
||||
0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x73, 0x73, |
||||
0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x23, 0x0a, |
||||
0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, |
||||
0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, |
||||
0x6e, 0x74, 0x32, 0x84, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x7c, 0x0a, 0x0d, 0x47, |
||||
0x65, 0x74, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x21, 0x2e, 0x61, |
||||
0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x79, |
||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, |
||||
0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, |
||||
0x74, 0x4d, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, |
||||
0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x12, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, |
||||
0x65, 0x72, 0x2f, 0x67, 0x65, 0x74, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2f, 0x7b, |
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x7d, 0x3a, 0x01, 0x2a, 0x42, 0x55, 0x0a, 0x0b, 0x61, 0x70, 0x69, |
||||
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x50, 0x01, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, |
||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, |
||||
0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, |
||||
0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x68, 0x74, 0x74, 0x70, 0x2d, 0x67, 0x72, 0x70, |
||||
0x63, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, |
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, |
||||
} |
||||
|
||||
var ( |
||||
file_user_proto_rawDescOnce sync.Once |
||||
file_user_proto_rawDescData = file_user_proto_rawDesc |
||||
) |
||||
|
||||
func file_user_proto_rawDescGZIP() []byte { |
||||
file_user_proto_rawDescOnce.Do(func() { |
||||
file_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_proto_rawDescData) |
||||
}) |
||||
return file_user_proto_rawDescData |
||||
} |
||||
|
||||
var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 3) |
||||
var file_user_proto_goTypes = []interface{}{ |
||||
(*GetMyMessagesRequest)(nil), // 0: api.user.v1.GetMyMessagesRequest
|
||||
(*GetMyMessagesReply)(nil), // 1: api.user.v1.GetMyMessagesReply
|
||||
(*Message)(nil), // 2: api.user.v1.Message
|
||||
} |
||||
var file_user_proto_depIdxs = []int32{ |
||||
2, // 0: api.user.v1.GetMyMessagesReply.messages:type_name -> api.user.v1.Message
|
||||
0, // 1: api.user.v1.User.GetMyMessages:input_type -> api.user.v1.GetMyMessagesRequest
|
||||
1, // 2: api.user.v1.User.GetMyMessages:output_type -> api.user.v1.GetMyMessagesReply
|
||||
2, // [2:3] is the sub-list for method output_type
|
||||
1, // [1:2] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
} |
||||
|
||||
func init() { file_user_proto_init() } |
||||
func file_user_proto_init() { |
||||
if File_user_proto != nil { |
||||
return |
||||
} |
||||
if !protoimpl.UnsafeEnabled { |
||||
file_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { |
||||
switch v := v.(*GetMyMessagesRequest); i { |
||||
case 0: |
||||
return &v.state |
||||
case 1: |
||||
return &v.sizeCache |
||||
case 2: |
||||
return &v.unknownFields |
||||
default: |
||||
return nil |
||||
} |
||||
} |
||||
file_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { |
||||
switch v := v.(*GetMyMessagesReply); i { |
||||
case 0: |
||||
return &v.state |
||||
case 1: |
||||
return &v.sizeCache |
||||
case 2: |
||||
return &v.unknownFields |
||||
default: |
||||
return nil |
||||
} |
||||
} |
||||
file_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { |
||||
switch v := v.(*Message); i { |
||||
case 0: |
||||
return &v.state |
||||
case 1: |
||||
return &v.sizeCache |
||||
case 2: |
||||
return &v.unknownFields |
||||
default: |
||||
return nil |
||||
} |
||||
} |
||||
} |
||||
type x struct{} |
||||
out := protoimpl.TypeBuilder{ |
||||
File: protoimpl.DescBuilder{ |
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), |
||||
RawDescriptor: file_user_proto_rawDesc, |
||||
NumEnums: 0, |
||||
NumMessages: 3, |
||||
NumExtensions: 0, |
||||
NumServices: 1, |
||||
}, |
||||
GoTypes: file_user_proto_goTypes, |
||||
DependencyIndexes: file_user_proto_depIdxs, |
||||
MessageInfos: file_user_proto_msgTypes, |
||||
}.Build() |
||||
File_user_proto = out.File |
||||
file_user_proto_rawDesc = nil |
||||
file_user_proto_goTypes = nil |
||||
file_user_proto_depIdxs = nil |
||||
} |
@ -0,0 +1,30 @@ |
||||
syntax = "proto3"; |
||||
|
||||
package api.user.v1; |
||||
|
||||
option go_package = "github.com/go-kratos/kratos/examples/kratos-http-grpc/api/user/v1;v1"; |
||||
option java_multiple_files = true; |
||||
option java_package = "api.user.v1"; |
||||
|
||||
import "google/api/annotations.proto"; |
||||
|
||||
service User { |
||||
rpc GetMyMessages (GetMyMessagesRequest) returns (GetMyMessagesReply){ |
||||
option (google.api.http) = { |
||||
get: "/v1/user/get/message/{count}" |
||||
body: "*" |
||||
}; |
||||
} |
||||
} |
||||
|
||||
|
||||
message GetMyMessagesRequest { |
||||
int64 count = 1; |
||||
} |
||||
message GetMyMessagesReply { |
||||
repeated Message messages = 1; |
||||
} |
||||
|
||||
message Message { |
||||
string content = 1; |
||||
} |
@ -0,0 +1,101 @@ |
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package v1 |
||||
|
||||
import ( |
||||
context "context" |
||||
grpc "google.golang.org/grpc" |
||||
codes "google.golang.org/grpc/codes" |
||||
status "google.golang.org/grpc/status" |
||||
) |
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7 |
||||
|
||||
// UserClient is the client API for User service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type UserClient interface { |
||||
GetMyMessages(ctx context.Context, in *GetMyMessagesRequest, opts ...grpc.CallOption) (*GetMyMessagesReply, error) |
||||
} |
||||
|
||||
type userClient struct { |
||||
cc grpc.ClientConnInterface |
||||
} |
||||
|
||||
func NewUserClient(cc grpc.ClientConnInterface) UserClient { |
||||
return &userClient{cc} |
||||
} |
||||
|
||||
func (c *userClient) GetMyMessages(ctx context.Context, in *GetMyMessagesRequest, opts ...grpc.CallOption) (*GetMyMessagesReply, error) { |
||||
out := new(GetMyMessagesReply) |
||||
err := c.cc.Invoke(ctx, "/api.user.v1.User/GetMyMessages", in, out, opts...) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
return out, nil |
||||
} |
||||
|
||||
// UserServer is the server API for User service.
|
||||
// All implementations must embed UnimplementedUserServer
|
||||
// for forward compatibility
|
||||
type UserServer interface { |
||||
GetMyMessages(context.Context, *GetMyMessagesRequest) (*GetMyMessagesReply, error) |
||||
mustEmbedUnimplementedUserServer() |
||||
} |
||||
|
||||
// UnimplementedUserServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedUserServer struct { |
||||
} |
||||
|
||||
func (UnimplementedUserServer) GetMyMessages(context.Context, *GetMyMessagesRequest) (*GetMyMessagesReply, error) { |
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMyMessages not implemented") |
||||
} |
||||
func (UnimplementedUserServer) mustEmbedUnimplementedUserServer() {} |
||||
|
||||
// UnsafeUserServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to UserServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeUserServer interface { |
||||
mustEmbedUnimplementedUserServer() |
||||
} |
||||
|
||||
func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer) { |
||||
s.RegisterService(&User_ServiceDesc, srv) |
||||
} |
||||
|
||||
func _User_GetMyMessages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |
||||
in := new(GetMyMessagesRequest) |
||||
if err := dec(in); err != nil { |
||||
return nil, err |
||||
} |
||||
if interceptor == nil { |
||||
return srv.(UserServer).GetMyMessages(ctx, in) |
||||
} |
||||
info := &grpc.UnaryServerInfo{ |
||||
Server: srv, |
||||
FullMethod: "/api.user.v1.User/GetMyMessages", |
||||
} |
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) { |
||||
return srv.(UserServer).GetMyMessages(ctx, req.(*GetMyMessagesRequest)) |
||||
} |
||||
return interceptor(ctx, in, info, handler) |
||||
} |
||||
|
||||
// User_ServiceDesc is the grpc.ServiceDesc for User service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var User_ServiceDesc = grpc.ServiceDesc{ |
||||
ServiceName: "api.user.v1.User", |
||||
HandlerType: (*UserServer)(nil), |
||||
Methods: []grpc.MethodDesc{ |
||||
{ |
||||
MethodName: "GetMyMessages", |
||||
Handler: _User_GetMyMessages_Handler, |
||||
}, |
||||
}, |
||||
Streams: []grpc.StreamDesc{}, |
||||
Metadata: "user.proto", |
||||
} |
@ -0,0 +1,63 @@ |
||||
// Code generated by protoc-gen-go-http. DO NOT EDIT.
|
||||
|
||||
package v1 |
||||
|
||||
import ( |
||||
context "context" |
||||
http1 "github.com/go-kratos/kratos/v2/transport/http" |
||||
binding "github.com/go-kratos/kratos/v2/transport/http/binding" |
||||
mux "github.com/gorilla/mux" |
||||
http "net/http" |
||||
) |
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the kratos package it is being compiled against.
|
||||
var _ = new(http.Request) |
||||
var _ = new(context.Context) |
||||
var _ = binding.MapProto |
||||
var _ = mux.NewRouter |
||||
|
||||
const _ = http1.SupportPackageIsVersion1 |
||||
|
||||
type UserHandler interface { |
||||
GetMyMessages(context.Context, *GetMyMessagesRequest) (*GetMyMessagesReply, error) |
||||
} |
||||
|
||||
func NewUserHandler(srv UserHandler, opts ...http1.HandleOption) http.Handler { |
||||
h := http1.DefaultHandleOptions() |
||||
for _, o := range opts { |
||||
o(&h) |
||||
} |
||||
r := mux.NewRouter() |
||||
|
||||
r.HandleFunc("/v1/user/get/message/{count}", func(w http.ResponseWriter, r *http.Request) { |
||||
var in GetMyMessagesRequest |
||||
if err := h.Decode(r, &in); err != nil { |
||||
h.Error(w, r, err) |
||||
return |
||||
} |
||||
|
||||
if err := binding.MapProto(&in, mux.Vars(r)); err != nil { |
||||
h.Error(w, r, err) |
||||
return |
||||
} |
||||
|
||||
next := func(ctx context.Context, req interface{}) (interface{}, error) { |
||||
return srv.GetMyMessages(ctx, req.(*GetMyMessagesRequest)) |
||||
} |
||||
if h.Middleware != nil { |
||||
next = h.Middleware(next) |
||||
} |
||||
out, err := next(r.Context(), &in) |
||||
if err != nil { |
||||
h.Error(w, r, err) |
||||
return |
||||
} |
||||
reply := out.(*GetMyMessagesReply) |
||||
if err := h.Encode(w, r, reply); err != nil { |
||||
h.Error(w, r, err) |
||||
} |
||||
}).Methods("GET") |
||||
|
||||
return r |
||||
} |
@ -0,0 +1,105 @@ |
||||
package main |
||||
|
||||
import ( |
||||
"context" |
||||
pb "github.com/go-kratos/kratos/examples/traces/api/message" |
||||
"github.com/go-kratos/kratos/v2" |
||||
"github.com/go-kratos/kratos/v2/log" |
||||
"github.com/go-kratos/kratos/v2/middleware" |
||||
"github.com/go-kratos/kratos/v2/middleware/logging" |
||||
"github.com/go-kratos/kratos/v2/middleware/recovery" |
||||
"github.com/go-kratos/kratos/v2/middleware/tracing" |
||||
"github.com/go-kratos/kratos/v2/transport/grpc" |
||||
"go.opentelemetry.io/otel/attribute" |
||||
"go.opentelemetry.io/otel/exporters/trace/jaeger" |
||||
"go.opentelemetry.io/otel/propagation" |
||||
"go.opentelemetry.io/otel/sdk/resource" |
||||
tracesdk "go.opentelemetry.io/otel/sdk/trace" |
||||
"go.opentelemetry.io/otel/semconv" |
||||
"go.opentelemetry.io/otel/trace" |
||||
"os" |
||||
) |
||||
|
||||
// go build -ldflags "-X main.Version=x.y.z"
|
||||
var ( |
||||
// Name is the name of the compiled software.
|
||||
Name = "message" |
||||
// Version is the version of the compiled software.
|
||||
Version = "v1.0.0" |
||||
) |
||||
|
||||
// server is used to implement helloworld.GreeterServer.
|
||||
type server struct { |
||||
pb.UnimplementedMessageServiceServer |
||||
tracer trace.TracerProvider |
||||
} |
||||
|
||||
// Get trace provider
|
||||
func tracerProvider(url string) (*tracesdk.TracerProvider, error) { |
||||
// Create the Jaeger exporter
|
||||
exp, err := jaeger.NewRawExporter(jaeger.WithCollectorEndpoint(jaeger.WithEndpoint(url))) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
tp := tracesdk.NewTracerProvider( |
||||
tracesdk.WithSampler(tracesdk.AlwaysSample()), |
||||
// Always be sure to batch in production.
|
||||
tracesdk.WithBatcher(exp), |
||||
// Record information about this application in an Resource.
|
||||
tracesdk.WithResource(resource.NewWithAttributes( |
||||
semconv.ServiceNameKey.String(pb.MessageService_ServiceDesc.ServiceName), |
||||
attribute.String("environment", "development"), |
||||
attribute.Int64("ID", 1), |
||||
)), |
||||
) |
||||
return tp, nil |
||||
} |
||||
|
||||
func (s *server) GetUserMessage(ctx context.Context, request *pb.GetUserMessageRequest) (*pb.GetUserMessageReply, error) { |
||||
msgs := &pb.GetUserMessageReply{} |
||||
for i := 0; i < int(request.Count); i++ { |
||||
msgs.Messages = append(msgs.Messages,&pb.Message{Content: "Teletubbies say hello."}) |
||||
} |
||||
return msgs, nil |
||||
} |
||||
|
||||
func main() { |
||||
logger := log.NewStdLogger(os.Stdout) |
||||
|
||||
log := log.NewHelper("user", logger) |
||||
|
||||
tp, err := tracerProvider("http://jaeger:14268/api/traces") |
||||
if err != nil { |
||||
log.Error(err) |
||||
} |
||||
|
||||
s := &server{tracer: tp} |
||||
// grpc server
|
||||
grpcSrv := grpc.NewServer( |
||||
grpc.Address(":9000"), |
||||
grpc.Middleware( |
||||
middleware.Chain( |
||||
recovery.Recovery(), |
||||
// Configuring tracing Middleware
|
||||
tracing.Server( |
||||
tracing.WithTracerProvider(tp), |
||||
tracing.WithPropagators( |
||||
propagation.NewCompositeTextMapPropagator(propagation.Baggage{}, propagation.TraceContext{}), |
||||
), |
||||
), |
||||
logging.Server(logger), |
||||
), |
||||
)) |
||||
pb.RegisterMessageServiceServer(grpcSrv, s) |
||||
|
||||
app := kratos.New( |
||||
kratos.Name(Name), |
||||
kratos.Server( |
||||
grpcSrv, |
||||
), |
||||
) |
||||
|
||||
if err := app.Run(); err != nil { |
||||
log.Error(err) |
||||
} |
||||
} |
@ -0,0 +1,130 @@ |
||||
package main |
||||
|
||||
import ( |
||||
"context" |
||||
message "github.com/go-kratos/kratos/examples/traces/api/message" |
||||
pb "github.com/go-kratos/kratos/examples/traces/api/user" |
||||
"github.com/go-kratos/kratos/v2" |
||||
"github.com/go-kratos/kratos/v2/log" |
||||
"github.com/go-kratos/kratos/v2/middleware" |
||||
"github.com/go-kratos/kratos/v2/middleware/logging" |
||||
"github.com/go-kratos/kratos/v2/middleware/recovery" |
||||
"github.com/go-kratos/kratos/v2/middleware/tracing" |
||||
"github.com/go-kratos/kratos/v2/transport/grpc" |
||||
"github.com/go-kratos/kratos/v2/transport/http" |
||||
"go.opentelemetry.io/otel/attribute" |
||||
"go.opentelemetry.io/otel/exporters/trace/jaeger" |
||||
"go.opentelemetry.io/otel/propagation" |
||||
"go.opentelemetry.io/otel/sdk/resource" |
||||
tracesdk "go.opentelemetry.io/otel/sdk/trace" |
||||
"go.opentelemetry.io/otel/semconv" |
||||
"go.opentelemetry.io/otel/trace" |
||||
"os" |
||||
"time" |
||||
) |
||||
|
||||
// go build -ldflags "-X main.Version=x.y.z"
|
||||
var ( |
||||
// Name is the name of the compiled software.
|
||||
Name = "user" |
||||
// Version is the version of the compiled software.
|
||||
Version = "v1.0.0" |
||||
) |
||||
|
||||
// server is used to implement helloworld.GreeterServer.
|
||||
type server struct { |
||||
pb.UnimplementedUserServer |
||||
tracer trace.TracerProvider |
||||
} |
||||
|
||||
// Get trace provider
|
||||
func tracerProvider(url string) (*tracesdk.TracerProvider, error) { |
||||
// Create the Jaeger exporter
|
||||
exp, err := jaeger.NewRawExporter(jaeger.WithCollectorEndpoint(jaeger.WithEndpoint(url))) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
tp := tracesdk.NewTracerProvider( |
||||
tracesdk.WithSampler(tracesdk.AlwaysSample()), |
||||
// Always be sure to batch in production.
|
||||
tracesdk.WithBatcher(exp), |
||||
// Record information about this application in an Resource.
|
||||
tracesdk.WithResource(resource.NewWithAttributes( |
||||
semconv.ServiceNameKey.String(pb.User_ServiceDesc.ServiceName), |
||||
attribute.String("environment", "development"), |
||||
attribute.Int64("ID", 1), |
||||
)), |
||||
) |
||||
return tp, nil |
||||
} |
||||
|
||||
func (s *server) GetMyMessages(ctx context.Context, in *pb.GetMyMessagesRequest) (*pb.GetMyMessagesReply, error) { |
||||
// create grpc conn
|
||||
conn, err := grpc.DialInsecure(ctx, |
||||
grpc.WithEndpoint("127.0.0.1:9000"), |
||||
grpc.WithMiddleware(middleware.Chain( |
||||
tracing.Client( |
||||
tracing.WithTracerProvider(s.tracer), |
||||
tracing.WithPropagators( |
||||
propagation.NewCompositeTextMapPropagator(propagation.Baggage{}, propagation.TraceContext{}), |
||||
), |
||||
), |
||||
recovery.Recovery())), |
||||
grpc.WithTimeout(2*time.Second), |
||||
) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
msg := message.NewMessageServiceClient(conn) |
||||
// Method of calling blog service
|
||||
reply, err := msg.GetUserMessage(ctx, &message.GetUserMessageRequest{Id: 123, Count: in.Count}) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
res := &pb.GetMyMessagesReply{} |
||||
for _, v := range reply.Messages { |
||||
res.Messages = append(res.Messages,&pb.Message{Content: v.Content}) |
||||
} |
||||
return res, nil |
||||
} |
||||
|
||||
func main() { |
||||
logger := log.NewStdLogger(os.Stdout) |
||||
|
||||
log := log.NewHelper("user", logger) |
||||
|
||||
tp, err := tracerProvider("http://jaeger:14268/api/traces") |
||||
if err != nil { |
||||
log.Error(err) |
||||
} |
||||
|
||||
s := &server{tracer: tp} |
||||
|
||||
httpSrv := http.NewServer(http.Address(":8000")) |
||||
httpSrv.HandlePrefix("/", pb.NewUserHandler(s, |
||||
http.Middleware( |
||||
middleware.Chain( |
||||
recovery.Recovery(), |
||||
// Configuring tracing middleware
|
||||
tracing.Server( |
||||
tracing.WithTracerProvider(tp), |
||||
tracing.WithPropagators( |
||||
propagation.NewCompositeTextMapPropagator(propagation.Baggage{}, propagation.TraceContext{}), |
||||
), |
||||
), |
||||
logging.Server(logger), |
||||
), |
||||
)), |
||||
) |
||||
|
||||
app := kratos.New( |
||||
kratos.Name(Name), |
||||
kratos.Server( |
||||
httpSrv, |
||||
), |
||||
) |
||||
|
||||
if err := app.Run(); err != nil { |
||||
log.Error(err) |
||||
} |
||||
} |
@ -0,0 +1,20 @@ |
||||
version: '3' |
||||
services: |
||||
traces: |
||||
networks: |
||||
- traces |
||||
build: . |
||||
ports: |
||||
- "8000:8000" |
||||
- "9000:9000" |
||||
|
||||
jaeger: |
||||
image: jaegertracing/all-in-one:1.16 |
||||
ports: |
||||
- "16686:16686" |
||||
- "14268:14268" |
||||
networks: |
||||
- traces |
||||
networks: |
||||
traces: |
||||
driver: bridge |
@ -0,0 +1,15 @@ |
||||
module github.com/go-kratos/kratos/examples/traces |
||||
|
||||
go 1.15 |
||||
|
||||
require ( |
||||
github.com/go-kratos/kratos/v2 v2.0.0-beta4 |
||||
github.com/gorilla/mux v1.8.0 |
||||
go.opentelemetry.io/otel v0.20.0 |
||||
go.opentelemetry.io/otel/exporters/trace/jaeger v0.20.0 |
||||
go.opentelemetry.io/otel/sdk v0.20.0 |
||||
go.opentelemetry.io/otel/trace v0.20.0 |
||||
google.golang.org/genproto v0.0.0-20210518161634-ec7691c0a37d |
||||
google.golang.org/grpc v1.37.1 |
||||
google.golang.org/protobuf v1.26.0 |
||||
) |
@ -0,0 +1,160 @@ |
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= |
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= |
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= |
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= |
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= |
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= |
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= |
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= |
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= |
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= |
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= |
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= |
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= |
||||
github.com/go-kratos/kratos/v2 v2.0.0-beta4 h1:yIpOJg7iGVS58dR65O6P8b9EvX5V5gqgfX6dD8/1UkA= |
||||
github.com/go-kratos/kratos/v2 v2.0.0-beta4/go.mod h1:ABzj/OAz9XmjyeTirYBBIHqxmeV9Sbd9NXLx9CsCgbE= |
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= |
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= |
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= |
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= |
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= |
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= |
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= |
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= |
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= |
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= |
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= |
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= |
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= |
||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= |
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= |
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= |
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= |
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= |
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= |
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= |
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= |
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= |
||||
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= |
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= |
||||
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= |
||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= |
||||
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= |
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= |
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= |
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= |
||||
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= |
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= |
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= |
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= |
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= |
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= |
||||
go.opentelemetry.io/otel v0.19.0 h1:Lenfy7QHRXPZVsw/12CWpxX6d/JkrX8wrx2vO8G80Ng= |
||||
go.opentelemetry.io/otel v0.19.0/go.mod h1:j9bF567N9EfomkSidSfmMwIwIBuP37AMAIzVW85OxSg= |
||||
go.opentelemetry.io/otel v0.20.0 h1:eaP0Fqu7SXHwvjiqDq83zImeehOHX8doTvU9AwXON8g= |
||||
go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= |
||||
go.opentelemetry.io/otel/exporters/trace/jaeger v0.20.0 h1:FoclOadJNul1vUiKnZU0sKFWOZtZQq3jUzSbrX2jwNM= |
||||
go.opentelemetry.io/otel/exporters/trace/jaeger v0.20.0/go.mod h1:10qwvAmKpvwRO5lL3KQ8EWznPp89uGfhcbK152LFWsQ= |
||||
go.opentelemetry.io/otel/metric v0.19.0 h1:dtZ1Ju44gkJkYvo+3qGqVXmf88tc+a42edOywypengg= |
||||
go.opentelemetry.io/otel/metric v0.19.0/go.mod h1:8f9fglJPRnXuskQmKpnad31lcLJ2VmNNqIsx/uIwBSc= |
||||
go.opentelemetry.io/otel/metric v0.20.0 h1:4kzhXFP+btKm4jwxpjIqjs41A7MakRFUS86bqLHTIw8= |
||||
go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= |
||||
go.opentelemetry.io/otel/oteltest v0.19.0 h1:YVfA0ByROYqTwOxqHVZYZExzEpfZor+MU1rU+ip2v9Q= |
||||
go.opentelemetry.io/otel/oteltest v0.19.0/go.mod h1:tI4yxwh8U21v7JD6R3BcA/2+RBoTKFexE/PJ/nSO7IA= |
||||
go.opentelemetry.io/otel/oteltest v0.20.0 h1:HiITxCawalo5vQzdHfKeZurV8x7ljcqAgiWzF6Vaeaw= |
||||
go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= |
||||
go.opentelemetry.io/otel/sdk v0.20.0 h1:JsxtGXd06J8jrnya7fdI/U/MR6yXA5DtbZy+qoHQlr8= |
||||
go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= |
||||
go.opentelemetry.io/otel/trace v0.19.0 h1:1ucYlenXIDA1OlHVLDZKX0ObXV5RLaq06DtUKz5e5zc= |
||||
go.opentelemetry.io/otel/trace v0.19.0/go.mod h1:4IXiNextNOpPnRlI4ryK69mn5iC84bjBWZQA5DXz/qg= |
||||
go.opentelemetry.io/otel/trace v0.20.0 h1:1DL6EXUdcg95gukhuRRvLDO/4X5THh/5dIV52lqtnbw= |
||||
go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= |
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= |
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= |
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= |
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= |
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= |
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= |
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= |
||||
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= |
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= |
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= |
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= |
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= |
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= |
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= |
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= |
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= |
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= |
||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E= |
||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= |
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= |
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= |
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= |
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= |
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
||||
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc= |
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= |
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= |
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= |
||||
golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= |
||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= |
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= |
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= |
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= |
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= |
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= |
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= |
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= |
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= |
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= |
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= |
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= |
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= |
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= |
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= |
||||
google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= |
||||
google.golang.org/genproto v0.0.0-20210518161634-ec7691c0a37d h1:bRz6UmsZEz/CzoTjUDp4ZcdguhSWi6CyU299wMQBpZU= |
||||
google.golang.org/genproto v0.0.0-20210518161634-ec7691c0a37d/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= |
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= |
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= |
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= |
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= |
||||
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= |
||||
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= |
||||
google.golang.org/grpc v1.37.1 h1:ARnQJNWxGyYJpdf/JXscNlQr/uv607ZPU9Z7ogHi+iI= |
||||
google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= |
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= |
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= |
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= |
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= |
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= |
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= |
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= |
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= |
||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= |
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= |
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= |
||||
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= |
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= |
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= |
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= |
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= |
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= |
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= |
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= |
@ -0,0 +1,2 @@ |
||||
/app/user & |
||||
nohup /app/message |
Loading…
Reference in new issue