Merge pull request #1018 from micro/debug-service

Debug service
This commit is contained in:
Asim Aslam 2019-12-04 14:40:58 +00:00 committed by GitHub
commit 26755f86b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 102 additions and 63 deletions

View File

@ -7,7 +7,7 @@ import (
"time"
"github.com/micro/go-micro/debug/log"
proto "github.com/micro/go-micro/debug/proto"
proto "github.com/micro/go-micro/debug/service/proto"
"github.com/micro/go-micro/server"
)

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: debug.proto
// source: github.com/micro/go-micro/debug/proto/debug.proto
package debug
@ -21,6 +21,8 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
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:"-"`
@ -30,7 +32,7 @@ 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_8d9d361be58531fb, []int{0}
return fileDescriptor_7cb19b1a05a6e0a9, []int{0}
}
func (m *HealthRequest) XXX_Unmarshal(b []byte) error {
@ -51,6 +53,13 @@ func (m *HealthRequest) XXX_DiscardUnknown() {
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"`
@ -63,7 +72,7 @@ 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_8d9d361be58531fb, []int{1}
return fileDescriptor_7cb19b1a05a6e0a9, []int{1}
}
func (m *HealthResponse) XXX_Unmarshal(b []byte) error {
@ -92,6 +101,8 @@ func (m *HealthResponse) GetStatus() string {
}
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:"-"`
@ -101,7 +112,7 @@ 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_8d9d361be58531fb, []int{2}
return fileDescriptor_7cb19b1a05a6e0a9, []int{2}
}
func (m *StatsRequest) XXX_Unmarshal(b []byte) error {
@ -122,6 +133,13 @@ func (m *StatsRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_StatsRequest proto.InternalMessageInfo
func (m *StatsRequest) GetService() string {
if m != nil {
return m.Service
}
return ""
}
type StatsResponse struct {
// unix timestamp
Started uint64 `protobuf:"varint,1,opt,name=started,proto3" json:"started,omitempty"`
@ -142,7 +160,7 @@ 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_8d9d361be58531fb, []int{3}
return fileDescriptor_7cb19b1a05a6e0a9, []int{3}
}
func (m *StatsResponse) XXX_Unmarshal(b []byte) error {
@ -200,14 +218,16 @@ func (m *StatsResponse) GetGc() uint64 {
// 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,1,opt,name=count,proto3" json:"count,omitempty"`
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,2,opt,name=since,proto3" json:"since,omitempty"`
// stream records continuously
Stream bool `protobuf:"varint,3,opt,name=stream,proto3" json:"stream,omitempty"`
Since int64 `protobuf:"varint,4,opt,name=since,proto3" json:"since,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -217,7 +237,7 @@ 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_8d9d361be58531fb, []int{4}
return fileDescriptor_7cb19b1a05a6e0a9, []int{4}
}
func (m *LogRequest) XXX_Unmarshal(b []byte) error {
@ -238,6 +258,20 @@ func (m *LogRequest) XXX_DiscardUnknown() {
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
@ -252,13 +286,6 @@ func (m *LogRequest) GetSince() int64 {
return 0
}
func (m *LogRequest) GetStream() bool {
if m != nil {
return m.Stream
}
return false
}
// Record is service log record
type Record struct {
// timestamp of log record
@ -276,7 +303,7 @@ 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_8d9d361be58531fb, []int{5}
return fileDescriptor_7cb19b1a05a6e0a9, []int{5}
}
func (m *Record) XXX_Unmarshal(b []byte) error {
@ -328,31 +355,35 @@ func init() {
proto.RegisterMapType((map[string]string)(nil), "Record.MetadataEntry")
}
func init() { proto.RegisterFile("debug.proto", fileDescriptor_8d9d361be58531fb) }
var fileDescriptor_8d9d361be58531fb = []byte{
// 364 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x41, 0x6b, 0xdb, 0x30,
0x1c, 0xc5, 0x63, 0x3b, 0x76, 0x92, 0x7f, 0x66, 0x67, 0x88, 0x6d, 0x18, 0xb3, 0x43, 0xd0, 0xc9,
0x30, 0x10, 0x5b, 0x76, 0x19, 0xdb, 0x75, 0x85, 0x1e, 0x52, 0x28, 0xea, 0x27, 0x50, 0x6c, 0xe1,
0x84, 0xc6, 0x96, 0x6b, 0xfd, 0x5d, 0xc8, 0xad, 0xd0, 0xaf, 0xd3, 0x0f, 0x59, 0x64, 0x29, 0x4d,
0x0d, 0xbd, 0xf9, 0xf7, 0xe4, 0xff, 0x7b, 0x92, 0x9e, 0x60, 0x59, 0xca, 0x5d, 0x5f, 0xb1, 0xb6,
0x53, 0xa8, 0xe8, 0x0a, 0xe2, 0x6b, 0x29, 0x8e, 0xb8, 0xe7, 0xf2, 0xa1, 0x97, 0x1a, 0x69, 0x0e,
0xc9, 0x59, 0xd0, 0xad, 0x6a, 0xb4, 0x24, 0xdf, 0x20, 0xd2, 0x28, 0xb0, 0xd7, 0xa9, 0xb7, 0xf6,
0xf2, 0x05, 0x77, 0x44, 0x13, 0xf8, 0x74, 0x87, 0x02, 0xf5, 0x79, 0xf2, 0xd9, 0x83, 0xd8, 0x09,
0x6e, 0x32, 0x85, 0x99, 0x46, 0xd1, 0xa1, 0x2c, 0x87, 0xd1, 0x29, 0x3f, 0xa3, 0xf1, 0xec, 0x5b,
0x3c, 0xd4, 0x32, 0xf5, 0x87, 0x05, 0x47, 0x46, 0xaf, 0x65, 0xad, 0xba, 0x53, 0x1a, 0x58, 0xdd,
0x92, 0x71, 0xc2, 0x7d, 0x27, 0x45, 0xa9, 0xd3, 0xa9, 0x75, 0x72, 0x48, 0x12, 0xf0, 0xab, 0x22,
0x0d, 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, 0x02, 0x00, 0x00,
func init() {
proto.RegisterFile("github.com/micro/go-micro/debug/proto/debug.proto", fileDescriptor_7cb19b1a05a6e0a9)
}
var fileDescriptor_7cb19b1a05a6e0a9 = []byte{
// 400 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcd, 0x8a, 0x13, 0x41,
0x10, 0xc7, 0x33, 0x99, 0x24, 0xbb, 0xa9, 0x35, 0x51, 0x1a, 0x95, 0x21, 0x78, 0x08, 0x7d, 0x1a,
0x11, 0x3b, 0xee, 0x7a, 0x11, 0xbd, 0x2a, 0x78, 0x58, 0x2f, 0xed, 0x13, 0x74, 0x7a, 0x8a, 0xc9,
0xe8, 0x76, 0x3a, 0x76, 0xd7, 0x2c, 0xe4, 0x26, 0xf8, 0x3a, 0x3e, 0xa4, 0xf4, 0x47, 0x5c, 0x07,
0x84, 0xdc, 0xea, 0xf7, 0xef, 0x7f, 0xd7, 0x07, 0x55, 0x70, 0xdd, 0x76, 0xb4, 0xeb, 0xb7, 0x42,
0x5b, 0xb3, 0x31, 0x9d, 0x76, 0x76, 0xd3, 0xda, 0xd7, 0x29, 0x68, 0x70, 0xdb, 0xb7, 0x9b, 0x83,
0xb3, 0x94, 0x63, 0x11, 0x63, 0xfe, 0x12, 0x16, 0x9f, 0x51, 0xdd, 0xd1, 0x4e, 0xe2, 0x8f, 0x1e,
0x3d, 0xb1, 0x0a, 0x2e, 0x3c, 0xba, 0xfb, 0x4e, 0x63, 0x55, 0xac, 0x8b, 0x7a, 0x2e, 0x4f, 0xc8,
0x6b, 0x58, 0x9e, 0xac, 0xfe, 0x60, 0xf7, 0x1e, 0xd9, 0x73, 0x98, 0x79, 0x52, 0xd4, 0xfb, 0x6c,
0xcd, 0xc4, 0x6b, 0x78, 0xf4, 0x95, 0x14, 0xf9, 0xf3, 0x39, 0x7f, 0x15, 0xb0, 0xc8, 0xd6, 0x9c,
0x33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0xde, 0x05, 0x1f, 0xb1, 0x1a, 0xa6, 0x71, 0xad,
0x6c, 0x21, 0xfe, 0xbd, 0x84, 0xd5, 0x52, 0x0c, 0xb6, 0xcd, 0x47, 0x6c, 0x0d, 0x93, 0x5b, 0xdb,
0x7a, 0x76, 0x25, 0x1e, 0x56, 0xb0, 0xba, 0xc8, 0x33, 0xf1, 0xd1, 0x9b, 0x62, 0x3b, 0x8b, 0x97,
0xfa, 0xf6, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x35, 0x1e, 0x9c, 0xa7, 0xde, 0x02, 0x00, 0x00,
}

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: debug.proto
// source: github.com/micro/go-micro/debug/proto/debug.proto
package debug

View File

@ -6,14 +6,20 @@ service Debug {
rpc Logs(LogRequest) returns (stream Record) {};
}
message HealthRequest {}
message HealthRequest {
// optional service name
string service = 1;
}
message HealthResponse {
// default: ok
string status = 1;
}
message StatsRequest {}
message StatsRequest {
// optional service name
string service = 1;
}
message StatsResponse {
// unix timestamp
@ -30,14 +36,16 @@ message StatsResponse {
// 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 = 1;
int64 count = 3;
// relative time in seconds
// before the current time
// from which to show logs
int64 since = 2;
// stream records continuously
bool stream = 3;
int64 since = 4;
}
// Record is service log record

View File

@ -8,7 +8,7 @@ import (
"github.com/micro/go-micro/client"
"github.com/micro/go-micro/debug/log"
pb "github.com/micro/go-micro/debug/proto"
pb "github.com/micro/go-micro/debug/service/proto"
)
// Debug provides debug service client

View File

@ -5,7 +5,7 @@ import (
"sync"
"testing"
proto "github.com/micro/go-micro/debug/proto"
proto "github.com/micro/go-micro/debug/service/proto"
"github.com/micro/go-micro/registry/memory"
"github.com/micro/go-micro/util/test"
)

View File

@ -7,7 +7,7 @@ import (
"time"
"github.com/micro/go-micro/client"
pb "github.com/micro/go-micro/debug/proto"
pb "github.com/micro/go-micro/debug/service/proto"
"github.com/micro/go-micro/registry"
"github.com/micro/go-micro/registry/cache"
)

View File

@ -9,7 +9,7 @@ import (
"github.com/micro/go-micro/client"
"github.com/micro/go-micro/config/cmd"
"github.com/micro/go-micro/debug/handler"
"github.com/micro/go-micro/debug/service/handler"
"github.com/micro/go-micro/debug/profile"
"github.com/micro/go-micro/debug/profile/pprof"
"github.com/micro/go-micro/plugin"

View File

@ -8,7 +8,7 @@ import (
glog "github.com/go-log/log"
"github.com/micro/go-micro/client"
proto "github.com/micro/go-micro/debug/proto"
proto "github.com/micro/go-micro/debug/service/proto"
"github.com/micro/go-micro/registry/memory"
"github.com/micro/go-micro/util/log"
"github.com/micro/go-micro/util/test"

View File

@ -5,7 +5,7 @@ import (
"context"
"sync"
"github.com/micro/go-micro/debug/handler"
"github.com/micro/go-micro/debug/service/handler"
"github.com/micro/go-micro/proxy"
"github.com/micro/go-micro/server"
)