1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-07-12 22:41:07 +02:00

add trace to handler

This commit is contained in:
Asim Aslam
2020-01-24 21:29:29 +00:00
parent 8d2dc8a822
commit 49cc022ca2
4 changed files with 282 additions and 28 deletions

View File

@ -372,6 +372,179 @@ func (m *Record) GetMessage() string {
return ""
}
type TraceRequest struct {
// trace id to retrieve
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TraceRequest) Reset() { *m = TraceRequest{} }
func (m *TraceRequest) String() string { return proto.CompactTextString(m) }
func (*TraceRequest) ProtoMessage() {}
func (*TraceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_dea322649cde1ef2, []int{6}
}
func (m *TraceRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TraceRequest.Unmarshal(m, b)
}
func (m *TraceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TraceRequest.Marshal(b, m, deterministic)
}
func (m *TraceRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_TraceRequest.Merge(m, src)
}
func (m *TraceRequest) XXX_Size() int {
return xxx_messageInfo_TraceRequest.Size(m)
}
func (m *TraceRequest) XXX_DiscardUnknown() {
xxx_messageInfo_TraceRequest.DiscardUnknown(m)
}
var xxx_messageInfo_TraceRequest proto.InternalMessageInfo
func (m *TraceRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
type TraceResponse struct {
Spans []*Span `protobuf:"bytes,1,rep,name=spans,proto3" json:"spans,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TraceResponse) Reset() { *m = TraceResponse{} }
func (m *TraceResponse) String() string { return proto.CompactTextString(m) }
func (*TraceResponse) ProtoMessage() {}
func (*TraceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_dea322649cde1ef2, []int{7}
}
func (m *TraceResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TraceResponse.Unmarshal(m, b)
}
func (m *TraceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TraceResponse.Marshal(b, m, deterministic)
}
func (m *TraceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_TraceResponse.Merge(m, src)
}
func (m *TraceResponse) XXX_Size() int {
return xxx_messageInfo_TraceResponse.Size(m)
}
func (m *TraceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_TraceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_TraceResponse proto.InternalMessageInfo
func (m *TraceResponse) GetSpans() []*Span {
if m != nil {
return m.Spans
}
return nil
}
type Span struct {
// the trace id
Trace string `protobuf:"bytes,1,opt,name=trace,proto3" json:"trace,omitempty"`
// id of the span
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
// parent span
Parent string `protobuf:"bytes,3,opt,name=parent,proto3" json:"parent,omitempty"`
// name of the resource
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
// time of start in nanoseconds
Started uint64 `protobuf:"varint,5,opt,name=started,proto3" json:"started,omitempty"`
// duration of the execution in nanoseconds
Duration uint64 `protobuf:"varint,6,opt,name=duration,proto3" json:"duration,omitempty"`
// associated metadata
Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Span) Reset() { *m = Span{} }
func (m *Span) String() string { return proto.CompactTextString(m) }
func (*Span) ProtoMessage() {}
func (*Span) Descriptor() ([]byte, []int) {
return fileDescriptor_dea322649cde1ef2, []int{8}
}
func (m *Span) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Span.Unmarshal(m, b)
}
func (m *Span) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Span.Marshal(b, m, deterministic)
}
func (m *Span) XXX_Merge(src proto.Message) {
xxx_messageInfo_Span.Merge(m, src)
}
func (m *Span) XXX_Size() int {
return xxx_messageInfo_Span.Size(m)
}
func (m *Span) XXX_DiscardUnknown() {
xxx_messageInfo_Span.DiscardUnknown(m)
}
var xxx_messageInfo_Span proto.InternalMessageInfo
func (m *Span) GetTrace() string {
if m != nil {
return m.Trace
}
return ""
}
func (m *Span) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Span) GetParent() string {
if m != nil {
return m.Parent
}
return ""
}
func (m *Span) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Span) GetStarted() uint64 {
if m != nil {
return m.Started
}
return 0
}
func (m *Span) GetDuration() uint64 {
if m != nil {
return m.Duration
}
return 0
}
func (m *Span) GetMetadata() map[string]string {
if m != nil {
return m.Metadata
}
return nil
}
func init() {
proto.RegisterType((*HealthRequest)(nil), "HealthRequest")
proto.RegisterType((*HealthResponse)(nil), "HealthResponse")
@ -380,6 +553,10 @@ func init() {
proto.RegisterType((*LogRequest)(nil), "LogRequest")
proto.RegisterType((*Record)(nil), "Record")
proto.RegisterMapType((map[string]string)(nil), "Record.MetadataEntry")
proto.RegisterType((*TraceRequest)(nil), "TraceRequest")
proto.RegisterType((*TraceResponse)(nil), "TraceResponse")
proto.RegisterType((*Span)(nil), "Span")
proto.RegisterMapType((map[string]string)(nil), "Span.MetadataEntry")
}
func init() {
@ -387,32 +564,40 @@ func init() {
}
var fileDescriptor_dea322649cde1ef2 = []byte{
// 427 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcd, 0x6e, 0x13, 0x31,
0x14, 0x85, 0x33, 0x33, 0xcd, 0x24, 0xb9, 0x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 0xa1, 0xba, 0xb0, 0x03, 0x3b, 0x95, 0x77,
0x3f, 0xa1, 0x99, 0xe5, 0xac, 0x62, 0xf2, 0xb6, 0xb8, 0xac, 0x63, 0xfb, 0xdf, 0xff, 0x0b, 0x00,
0x00, 0xff, 0xff, 0x69, 0xc0, 0x33, 0x21, 0x2f, 0x03, 0x00, 0x00,
// 554 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6e, 0xd4, 0x30,
0x10, 0xde, 0x24, 0x9b, 0xdd, 0xcd, 0xb4, 0x09, 0xc8, 0xfc, 0x28, 0x0a, 0x08, 0x2a, 0x9f, 0x16,
0x01, 0x5e, 0x28, 0x17, 0x04, 0x57, 0x90, 0x38, 0x94, 0x8b, 0xcb, 0x0b, 0xb8, 0x89, 0x95, 0x06,
0x9a, 0x38, 0xd8, 0x4e, 0xa5, 0x7d, 0x24, 0x6e, 0xbc, 0x0c, 0x6f, 0xc3, 0x01, 0xf9, 0x27, 0xdb,
0x44, 0x08, 0xf5, 0xc0, 0xcd, 0xdf, 0xe7, 0x99, 0x2f, 0x33, 0x9f, 0x67, 0x02, 0xa4, 0x6d, 0x4a,
0x29, 0x76, 0xb5, 0x78, 0xe9, 0x0e, 0x15, 0xbf, 0x18, 0xea, 0x9d, 0xe2, 0xf2, 0xba, 0x29, 0xf9,
0xae, 0x97, 0x42, 0x7b, 0x8e, 0xd8, 0x33, 0x7e, 0x06, 0xe9, 0x27, 0xce, 0xae, 0xf4, 0x25, 0xe5,
0xdf, 0x07, 0xae, 0x34, 0xca, 0x61, 0xed, 0xa3, 0xf3, 0xe0, 0x24, 0xd8, 0x26, 0x74, 0x84, 0x78,
0x0b, 0xd9, 0x18, 0xaa, 0x7a, 0xd1, 0x29, 0x8e, 0x1e, 0xc2, 0x4a, 0x69, 0xa6, 0x07, 0xe5, 0x43,
0x3d, 0xc2, 0x5b, 0x38, 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