1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-08-04 21:42:57 +02:00

move debug handler

This commit is contained in:
Asim Aslam
2020-12-12 20:50:36 +00:00
parent 28afbf164f
commit 15a62ae0b9
12 changed files with 58 additions and 606 deletions

637
debug/proto/debug.pb.go Normal file
View File

@ -0,0 +1,637 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: proto/debug.proto
package debug
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// 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.ProtoPackageIsVersion3 // please upgrade the proto package
type SpanType int32
const (
SpanType_INBOUND SpanType = 0
SpanType_OUTBOUND SpanType = 1
)
var SpanType_name = map[int32]string{
0: "INBOUND",
1: "OUTBOUND",
}
var SpanType_value = map[string]int32{
"INBOUND": 0,
"OUTBOUND": 1,
}
func (x SpanType) String() string {
return proto.EnumName(SpanType_name, int32(x))
}
func (SpanType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_466b588516b7ea56, []int{0}
}
type HealthRequest struct {
// optional service name
Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *HealthRequest) Reset() { *m = HealthRequest{} }
func (m *HealthRequest) String() string { return proto.CompactTextString(m) }
func (*HealthRequest) ProtoMessage() {}
func (*HealthRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_466b588516b7ea56, []int{0}
}
func (m *HealthRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_HealthRequest.Unmarshal(m, b)
}
func (m *HealthRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_HealthRequest.Marshal(b, m, deterministic)
}
func (m *HealthRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_HealthRequest.Merge(m, src)
}
func (m *HealthRequest) XXX_Size() int {
return xxx_messageInfo_HealthRequest.Size(m)
}
func (m *HealthRequest) XXX_DiscardUnknown() {
xxx_messageInfo_HealthRequest.DiscardUnknown(m)
}
var xxx_messageInfo_HealthRequest proto.InternalMessageInfo
func (m *HealthRequest) GetService() string {
if m != nil {
return m.Service
}
return ""
}
type HealthResponse struct {
// default: ok
Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *HealthResponse) Reset() { *m = HealthResponse{} }
func (m *HealthResponse) String() string { return proto.CompactTextString(m) }
func (*HealthResponse) ProtoMessage() {}
func (*HealthResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_466b588516b7ea56, []int{1}
}
func (m *HealthResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_HealthResponse.Unmarshal(m, b)
}
func (m *HealthResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_HealthResponse.Marshal(b, m, deterministic)
}
func (m *HealthResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_HealthResponse.Merge(m, src)
}
func (m *HealthResponse) XXX_Size() int {
return xxx_messageInfo_HealthResponse.Size(m)
}
func (m *HealthResponse) XXX_DiscardUnknown() {
xxx_messageInfo_HealthResponse.DiscardUnknown(m)
}
var xxx_messageInfo_HealthResponse proto.InternalMessageInfo
func (m *HealthResponse) GetStatus() string {
if m != nil {
return m.Status
}
return ""
}
type StatsRequest struct {
// optional service name
Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *StatsRequest) Reset() { *m = StatsRequest{} }
func (m *StatsRequest) String() string { return proto.CompactTextString(m) }
func (*StatsRequest) ProtoMessage() {}
func (*StatsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_466b588516b7ea56, []int{2}
}
func (m *StatsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StatsRequest.Unmarshal(m, b)
}
func (m *StatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StatsRequest.Marshal(b, m, deterministic)
}
func (m *StatsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_StatsRequest.Merge(m, src)
}
func (m *StatsRequest) XXX_Size() int {
return xxx_messageInfo_StatsRequest.Size(m)
}
func (m *StatsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_StatsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_StatsRequest proto.InternalMessageInfo
func (m *StatsRequest) GetService() string {
if m != nil {
return m.Service
}
return ""
}
type StatsResponse struct {
// timestamp of recording
Timestamp uint64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
// unix timestamp
Started uint64 `protobuf:"varint,2,opt,name=started,proto3" json:"started,omitempty"`
// in seconds
Uptime uint64 `protobuf:"varint,3,opt,name=uptime,proto3" json:"uptime,omitempty"`
// in bytes
Memory uint64 `protobuf:"varint,4,opt,name=memory,proto3" json:"memory,omitempty"`
// num threads
Threads uint64 `protobuf:"varint,5,opt,name=threads,proto3" json:"threads,omitempty"`
// total gc in nanoseconds
Gc uint64 `protobuf:"varint,6,opt,name=gc,proto3" json:"gc,omitempty"`
// total number of requests
Requests uint64 `protobuf:"varint,7,opt,name=requests,proto3" json:"requests,omitempty"`
// total number of errors
Errors uint64 `protobuf:"varint,8,opt,name=errors,proto3" json:"errors,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *StatsResponse) Reset() { *m = StatsResponse{} }
func (m *StatsResponse) String() string { return proto.CompactTextString(m) }
func (*StatsResponse) ProtoMessage() {}
func (*StatsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_466b588516b7ea56, []int{3}
}
func (m *StatsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StatsResponse.Unmarshal(m, b)
}
func (m *StatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StatsResponse.Marshal(b, m, deterministic)
}
func (m *StatsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_StatsResponse.Merge(m, src)
}
func (m *StatsResponse) XXX_Size() int {
return xxx_messageInfo_StatsResponse.Size(m)
}
func (m *StatsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_StatsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_StatsResponse proto.InternalMessageInfo
func (m *StatsResponse) GetTimestamp() uint64 {
if m != nil {
return m.Timestamp
}
return 0
}
func (m *StatsResponse) GetStarted() uint64 {
if m != nil {
return m.Started
}
return 0
}
func (m *StatsResponse) GetUptime() uint64 {
if m != nil {
return m.Uptime
}
return 0
}
func (m *StatsResponse) GetMemory() uint64 {
if m != nil {
return m.Memory
}
return 0
}
func (m *StatsResponse) GetThreads() uint64 {
if m != nil {
return m.Threads
}
return 0
}
func (m *StatsResponse) GetGc() uint64 {
if m != nil {
return m.Gc
}
return 0
}
func (m *StatsResponse) GetRequests() uint64 {
if m != nil {
return m.Requests
}
return 0
}
func (m *StatsResponse) GetErrors() uint64 {
if m != nil {
return m.Errors
}
return 0
}
// LogRequest requests service logs
type LogRequest struct {
// service to request logs for
Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
// stream records continuously
Stream bool `protobuf:"varint,2,opt,name=stream,proto3" json:"stream,omitempty"`
// count of records to request
Count int64 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"`
// relative time in seconds
// before the current time
// from which to show logs
Since int64 `protobuf:"varint,4,opt,name=since,proto3" json:"since,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *LogRequest) Reset() { *m = LogRequest{} }
func (m *LogRequest) String() string { return proto.CompactTextString(m) }
func (*LogRequest) ProtoMessage() {}
func (*LogRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_466b588516b7ea56, []int{4}
}
func (m *LogRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LogRequest.Unmarshal(m, b)
}
func (m *LogRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LogRequest.Marshal(b, m, deterministic)
}
func (m *LogRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_LogRequest.Merge(m, src)
}
func (m *LogRequest) XXX_Size() int {
return xxx_messageInfo_LogRequest.Size(m)
}
func (m *LogRequest) XXX_DiscardUnknown() {
xxx_messageInfo_LogRequest.DiscardUnknown(m)
}
var xxx_messageInfo_LogRequest proto.InternalMessageInfo
func (m *LogRequest) GetService() string {
if m != nil {
return m.Service
}
return ""
}
func (m *LogRequest) GetStream() bool {
if m != nil {
return m.Stream
}
return false
}
func (m *LogRequest) GetCount() int64 {
if m != nil {
return m.Count
}
return 0
}
func (m *LogRequest) GetSince() int64 {
if m != nil {
return m.Since
}
return 0
}
// Record is service log record
type Record struct {
// timestamp of log record
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
// record metadata
Metadata map[string]string `protobuf:"bytes,2,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// message
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Record) Reset() { *m = Record{} }
func (m *Record) String() string { return proto.CompactTextString(m) }
func (*Record) ProtoMessage() {}
func (*Record) Descriptor() ([]byte, []int) {
return fileDescriptor_466b588516b7ea56, []int{5}
}
func (m *Record) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Record.Unmarshal(m, b)
}
func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Record.Marshal(b, m, deterministic)
}
func (m *Record) XXX_Merge(src proto.Message) {
xxx_messageInfo_Record.Merge(m, src)
}
func (m *Record) XXX_Size() int {
return xxx_messageInfo_Record.Size(m)
}
func (m *Record) XXX_DiscardUnknown() {
xxx_messageInfo_Record.DiscardUnknown(m)
}
var xxx_messageInfo_Record proto.InternalMessageInfo
func (m *Record) GetTimestamp() int64 {
if m != nil {
return m.Timestamp
}
return 0
}
func (m *Record) GetMetadata() map[string]string {
if m != nil {
return m.Metadata
}
return nil
}
func (m *Record) GetMessage() string {
if m != nil {
return m.Message
}
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_466b588516b7ea56, []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_466b588516b7ea56, []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"`
Type SpanType `protobuf:"varint,8,opt,name=type,proto3,enum=SpanType" json:"type,omitempty"`
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_466b588516b7ea56, []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 (m *Span) GetType() SpanType {
if m != nil {
return m.Type
}
return SpanType_INBOUND
}
func init() {
proto.RegisterEnum("SpanType", SpanType_name, SpanType_value)
proto.RegisterType((*HealthRequest)(nil), "HealthRequest")
proto.RegisterType((*HealthResponse)(nil), "HealthResponse")
proto.RegisterType((*StatsRequest)(nil), "StatsRequest")
proto.RegisterType((*StatsResponse)(nil), "StatsResponse")
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() { proto.RegisterFile("proto/debug.proto", fileDescriptor_466b588516b7ea56) }
var fileDescriptor_466b588516b7ea56 = []byte{
// 589 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xdb, 0x6e, 0xd3, 0x40,
0x10, 0x8d, 0xed, 0x38, 0xb1, 0xa7, 0x8d, 0x29, 0xcb, 0x45, 0x96, 0xb9, 0x55, 0x96, 0x90, 0xc2,
0x45, 0x2e, 0x94, 0x17, 0x04, 0x6f, 0xa8, 0x48, 0x20, 0x95, 0x56, 0xda, 0xb6, 0x1f, 0xb0, 0xb5,
0x47, 0xae, 0xa1, 0xbe, 0xb0, 0xbb, 0xae, 0x94, 0x6f, 0xe1, 0x0b, 0x78, 0xe3, 0x67, 0xf8, 0x1f,
0xb4, 0x17, 0xa7, 0xb1, 0x10, 0xea, 0x03, 0x6f, 0x7b, 0xce, 0xce, 0x9e, 0xcc, 0x9c, 0x1c, 0x0f,
0xdc, 0xee, 0x78, 0x2b, 0xdb, 0xbd, 0x02, 0xcf, 0xfb, 0x32, 0xd3, 0xe7, 0xf4, 0x19, 0x2c, 0x3e,
0x21, 0xbb, 0x94, 0x17, 0x14, 0xbf, 0xf7, 0x28, 0x24, 0x89, 0x61, 0x2e, 0x90, 0x5f, 0x55, 0x39,
0xc6, 0xce, 0xae, 0xb3, 0x0c, 0xe9, 0x00, 0xd3, 0x25, 0x44, 0x43, 0xa9, 0xe8, 0xda, 0x46, 0x20,
0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d9,
0xa9, 0x41, 0xce, 0xfe, 0x4f, 0x07, 0xfc, 0x03, 0xb5, 0x18, 0xc8, 0x13, 0xf0, 0x0e, 0xdb, 0x92,
0x6c, 0x65, 0xd7, 0x09, 0x4e, 0xe6, 0x36, 0x28, 0xe9, 0xe4, 0x95, 0x43, 0x5e, 0xc0, 0xcc, 0x2c,
0x02, 0x12, 0x65, 0xa3, 0xe5, 0x91, 0xdc, 0xca, 0xc6, 0x1b, 0x22, 0x9d, 0x90, 0x25, 0xf8, 0xfa,
0x03, 0x27, 0x8b, 0x6c, 0x73, 0x27, 0x24, 0x51, 0x36, 0xfa, 0xee, 0x4d, 0xa5, 0xfe, 0xd3, 0xc9,
0x22, 0xdb, 0x0c, 0x47, 0x12, 0x65, 0xa3, 0x2c, 0xa4, 0x93, 0xf3, 0x99, 0xde, 0x5d, 0x6f, 0xfe,
0x04, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x2d, 0xec, 0xd8, 0xd0, 0x04, 0x00, 0x00,
}

View File

@ -0,0 +1,219 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/debug.proto
package debug
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/go-micro/v2/api"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
)
// 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.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for Debug service
func NewDebugEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Debug service
type DebugService interface {
Log(ctx context.Context, in *LogRequest, opts ...client.CallOption) (Debug_LogService, error)
Health(ctx context.Context, in *HealthRequest, opts ...client.CallOption) (*HealthResponse, error)
Stats(ctx context.Context, in *StatsRequest, opts ...client.CallOption) (*StatsResponse, error)
Trace(ctx context.Context, in *TraceRequest, opts ...client.CallOption) (*TraceResponse, error)
}
type debugService struct {
c client.Client
name string
}
func NewDebugService(name string, c client.Client) DebugService {
return &debugService{
c: c,
name: name,
}
}
func (c *debugService) Log(ctx context.Context, in *LogRequest, opts ...client.CallOption) (Debug_LogService, error) {
req := c.c.NewRequest(c.name, "Debug.Log", &LogRequest{})
stream, err := c.c.Stream(ctx, req, opts...)
if err != nil {
return nil, err
}
if err := stream.Send(in); err != nil {
return nil, err
}
return &debugServiceLog{stream}, nil
}
type Debug_LogService interface {
Context() context.Context
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Recv() (*Record, error)
}
type debugServiceLog struct {
stream client.Stream
}
func (x *debugServiceLog) Close() error {
return x.stream.Close()
}
func (x *debugServiceLog) Context() context.Context {
return x.stream.Context()
}
func (x *debugServiceLog) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *debugServiceLog) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *debugServiceLog) Recv() (*Record, error) {
m := new(Record)
err := x.stream.Recv(m)
if err != nil {
return nil, err
}
return m, nil
}
func (c *debugService) Health(ctx context.Context, in *HealthRequest, opts ...client.CallOption) (*HealthResponse, error) {
req := c.c.NewRequest(c.name, "Debug.Health", in)
out := new(HealthResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *debugService) Stats(ctx context.Context, in *StatsRequest, opts ...client.CallOption) (*StatsResponse, error) {
req := c.c.NewRequest(c.name, "Debug.Stats", in)
out := new(StatsResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *debugService) Trace(ctx context.Context, in *TraceRequest, opts ...client.CallOption) (*TraceResponse, error) {
req := c.c.NewRequest(c.name, "Debug.Trace", in)
out := new(TraceResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Debug service
type DebugHandler interface {
Log(context.Context, *LogRequest, Debug_LogStream) error
Health(context.Context, *HealthRequest, *HealthResponse) error
Stats(context.Context, *StatsRequest, *StatsResponse) error
Trace(context.Context, *TraceRequest, *TraceResponse) error
}
func RegisterDebugHandler(s server.Server, hdlr DebugHandler, opts ...server.HandlerOption) error {
type debug interface {
Log(ctx context.Context, stream server.Stream) error
Health(ctx context.Context, in *HealthRequest, out *HealthResponse) error
Stats(ctx context.Context, in *StatsRequest, out *StatsResponse) error
Trace(ctx context.Context, in *TraceRequest, out *TraceResponse) error
}
type Debug struct {
debug
}
h := &debugHandler{hdlr}
return s.Handle(s.NewHandler(&Debug{h}, opts...))
}
type debugHandler struct {
DebugHandler
}
func (h *debugHandler) Log(ctx context.Context, stream server.Stream) error {
m := new(LogRequest)
if err := stream.Recv(m); err != nil {
return err
}
return h.DebugHandler.Log(ctx, m, &debugLogStream{stream})
}
type Debug_LogStream interface {
Context() context.Context
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*Record) error
}
type debugLogStream struct {
stream server.Stream
}
func (x *debugLogStream) Close() error {
return x.stream.Close()
}
func (x *debugLogStream) Context() context.Context {
return x.stream.Context()
}
func (x *debugLogStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *debugLogStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *debugLogStream) Send(m *Record) error {
return x.stream.Send(m)
}
func (h *debugHandler) Health(ctx context.Context, in *HealthRequest, out *HealthResponse) error {
return h.DebugHandler.Health(ctx, in, out)
}
func (h *debugHandler) Stats(ctx context.Context, in *StatsRequest, out *StatsResponse) error {
return h.DebugHandler.Stats(ctx, in, out)
}
func (h *debugHandler) Trace(ctx context.Context, in *TraceRequest, out *TraceResponse) error {
return h.DebugHandler.Trace(ctx, in, out)
}

99
debug/proto/debug.proto Normal file
View File

@ -0,0 +1,99 @@
syntax = "proto3";
service Debug {
rpc Log(LogRequest) returns (stream Record) {};
rpc Health(HealthRequest) returns (HealthResponse) {};
rpc Stats(StatsRequest) returns (StatsResponse) {};
rpc Trace(TraceRequest) returns (TraceResponse) {};
}
message HealthRequest {
// optional service name
string service = 1;
}
message HealthResponse {
// default: ok
string status = 1;
}
message StatsRequest {
// optional service name
string service = 1;
}
message StatsResponse {
// timestamp of recording
uint64 timestamp = 1;
// unix timestamp
uint64 started = 2;
// in seconds
uint64 uptime = 3;
// in bytes
uint64 memory = 4;
// num threads
uint64 threads = 5;
// total gc in nanoseconds
uint64 gc = 6;
// total number of requests
uint64 requests = 7;
// total number of errors
uint64 errors = 8;
}
// LogRequest requests service logs
message LogRequest {
// service to request logs for
string service = 1;
// stream records continuously
bool stream = 2;
// count of records to request
int64 count = 3;
// relative time in seconds
// before the current time
// from which to show logs
int64 since = 4;
}
// Record is service log record
message Record {
// timestamp of log record
int64 timestamp = 1;
// record metadata
map<string,string> metadata = 2;
// message
string message = 3;
}
message TraceRequest {
// trace id to retrieve
string id = 1;
}
message TraceResponse {
repeated Span spans = 1;
}
enum SpanType {
INBOUND = 0;
OUTBOUND = 1;
}
message Span {
// the trace id
string trace = 1;
// id of the span
string id = 2;
// parent span
string parent = 3;
// name of the resource
string name = 4;
// time of start in nanoseconds
uint64 started = 5;
// duration of the execution in nanoseconds
uint64 duration = 6;
// associated metadata
map<string,string> metadata = 7;
SpanType type = 8;
}