remove debug for now
This commit is contained in:
parent
f2139e2a16
commit
02d580600d
@ -1,17 +0,0 @@
|
||||
# Debug
|
||||
|
||||
Debug is a debugging library for microservices
|
||||
|
||||
## Overview
|
||||
|
||||
Debug is a pluggable library for debugging. It includes base level requirements for logging, tracing and metrics.
|
||||
Our goal is to provide a simple experience for understanding what's happening in a running system with zero dependencies
|
||||
by default or by plugging into robust systems like ELK, zipkin, etc.
|
||||
|
||||
## Features
|
||||
|
||||
- Health (Checks)
|
||||
- Log (Logging)
|
||||
- Stats (Metrics)
|
||||
- Trace (Requests)
|
||||
|
@ -1,2 +0,0 @@
|
||||
// Package handler provides handlers
|
||||
package handler
|
@ -1,17 +0,0 @@
|
||||
// Package http provides http handlers
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Handler struct{}
|
||||
|
||||
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case "/debug/health":
|
||||
case "/debug/log":
|
||||
case "/debug/stats":
|
||||
case "/debug/trace":
|
||||
}
|
||||
}
|
@ -1,157 +0,0 @@
|
||||
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
||||
// source: go-debug/handler/rpc/proto/debug.proto
|
||||
|
||||
/*
|
||||
Package go_micro_debug is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
go-debug/handler/rpc/proto/debug.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Check
|
||||
Log
|
||||
Stats
|
||||
Trace
|
||||
Request
|
||||
HealthResponse
|
||||
LogResponse
|
||||
StatsResponse
|
||||
TraceResponse
|
||||
*/
|
||||
package go_micro_debug
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
import (
|
||||
context "context"
|
||||
client "github.com/micro/go-micro/client"
|
||||
server "github.com/micro/go-micro/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.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ client.Option
|
||||
var _ server.Option
|
||||
|
||||
// Client API for Debug service
|
||||
|
||||
type DebugService interface {
|
||||
Health(ctx context.Context, in *Request, opts ...client.CallOption) (*HealthResponse, error)
|
||||
Log(ctx context.Context, in *Request, opts ...client.CallOption) (*LogResponse, error)
|
||||
Stats(ctx context.Context, in *Request, opts ...client.CallOption) (*StatsResponse, error)
|
||||
Trace(ctx context.Context, in *Request, opts ...client.CallOption) (*TraceResponse, error)
|
||||
}
|
||||
|
||||
type debugService struct {
|
||||
c client.Client
|
||||
name string
|
||||
}
|
||||
|
||||
func NewDebugService(name string, c client.Client) DebugService {
|
||||
if c == nil {
|
||||
c = client.NewClient()
|
||||
}
|
||||
if len(name) == 0 {
|
||||
name = "go.micro.debug"
|
||||
}
|
||||
return &debugService{
|
||||
c: c,
|
||||
name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *debugService) Health(ctx context.Context, in *Request, 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) Log(ctx context.Context, in *Request, opts ...client.CallOption) (*LogResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Debug.Log", in)
|
||||
out := new(LogResponse)
|
||||
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 *Request, 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 *Request, 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 {
|
||||
Health(context.Context, *Request, *HealthResponse) error
|
||||
Log(context.Context, *Request, *LogResponse) error
|
||||
Stats(context.Context, *Request, *StatsResponse) error
|
||||
Trace(context.Context, *Request, *TraceResponse) error
|
||||
}
|
||||
|
||||
func RegisterDebugHandler(s server.Server, hdlr DebugHandler, opts ...server.HandlerOption) error {
|
||||
type debug interface {
|
||||
Health(ctx context.Context, in *Request, out *HealthResponse) error
|
||||
Log(ctx context.Context, in *Request, out *LogResponse) error
|
||||
Stats(ctx context.Context, in *Request, out *StatsResponse) error
|
||||
Trace(ctx context.Context, in *Request, 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) Health(ctx context.Context, in *Request, out *HealthResponse) error {
|
||||
return h.DebugHandler.Health(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *debugHandler) Log(ctx context.Context, in *Request, out *LogResponse) error {
|
||||
return h.DebugHandler.Log(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *debugHandler) Stats(ctx context.Context, in *Request, out *StatsResponse) error {
|
||||
return h.DebugHandler.Stats(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *debugHandler) Trace(ctx context.Context, in *Request, out *TraceResponse) error {
|
||||
return h.DebugHandler.Trace(ctx, in, out)
|
||||
}
|
@ -1,561 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: go-debug/handler/rpc/proto/debug.proto
|
||||
|
||||
package go_micro_debug
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
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 Check struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Check) Reset() { *m = Check{} }
|
||||
func (m *Check) String() string { return proto.CompactTextString(m) }
|
||||
func (*Check) ProtoMessage() {}
|
||||
func (*Check) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a796f9dd3ce1270e, []int{0}
|
||||
}
|
||||
|
||||
func (m *Check) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Check.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Check) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Check.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Check) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Check.Merge(m, src)
|
||||
}
|
||||
func (m *Check) XXX_Size() int {
|
||||
return xxx_messageInfo_Check.Size(m)
|
||||
}
|
||||
func (m *Check) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Check.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Check proto.InternalMessageInfo
|
||||
|
||||
type Log struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Log) Reset() { *m = Log{} }
|
||||
func (m *Log) String() string { return proto.CompactTextString(m) }
|
||||
func (*Log) ProtoMessage() {}
|
||||
func (*Log) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a796f9dd3ce1270e, []int{1}
|
||||
}
|
||||
|
||||
func (m *Log) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Log.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Log.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Log) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Log.Merge(m, src)
|
||||
}
|
||||
func (m *Log) XXX_Size() int {
|
||||
return xxx_messageInfo_Log.Size(m)
|
||||
}
|
||||
func (m *Log) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Log.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Log proto.InternalMessageInfo
|
||||
|
||||
type Stats struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Stats) Reset() { *m = Stats{} }
|
||||
func (m *Stats) String() string { return proto.CompactTextString(m) }
|
||||
func (*Stats) ProtoMessage() {}
|
||||
func (*Stats) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a796f9dd3ce1270e, []int{2}
|
||||
}
|
||||
|
||||
func (m *Stats) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Stats.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Stats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Stats.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Stats) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Stats.Merge(m, src)
|
||||
}
|
||||
func (m *Stats) XXX_Size() int {
|
||||
return xxx_messageInfo_Stats.Size(m)
|
||||
}
|
||||
func (m *Stats) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Stats.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Stats proto.InternalMessageInfo
|
||||
|
||||
type Trace struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Trace) Reset() { *m = Trace{} }
|
||||
func (m *Trace) String() string { return proto.CompactTextString(m) }
|
||||
func (*Trace) ProtoMessage() {}
|
||||
func (*Trace) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a796f9dd3ce1270e, []int{3}
|
||||
}
|
||||
|
||||
func (m *Trace) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Trace.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Trace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Trace.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Trace) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Trace.Merge(m, src)
|
||||
}
|
||||
func (m *Trace) XXX_Size() int {
|
||||
return xxx_messageInfo_Trace.Size(m)
|
||||
}
|
||||
func (m *Trace) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Trace.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Trace proto.InternalMessageInfo
|
||||
|
||||
type Request struct {
|
||||
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 *Request) Reset() { *m = Request{} }
|
||||
func (m *Request) String() string { return proto.CompactTextString(m) }
|
||||
func (*Request) ProtoMessage() {}
|
||||
func (*Request) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a796f9dd3ce1270e, []int{4}
|
||||
}
|
||||
|
||||
func (m *Request) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Request.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Request.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Request) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Request.Merge(m, src)
|
||||
}
|
||||
func (m *Request) XXX_Size() int {
|
||||
return xxx_messageInfo_Request.Size(m)
|
||||
}
|
||||
func (m *Request) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Request.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Request proto.InternalMessageInfo
|
||||
|
||||
func (m *Request) GetId() string {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type HealthResponse struct {
|
||||
Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
|
||||
Checks []*Check `protobuf:"bytes,2,rep,name=checks,proto3" json:"checks,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_a796f9dd3ce1270e, []int{5}
|
||||
}
|
||||
|
||||
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 ""
|
||||
}
|
||||
|
||||
func (m *HealthResponse) GetChecks() []*Check {
|
||||
if m != nil {
|
||||
return m.Checks
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type LogResponse struct {
|
||||
Logs []*Log `protobuf:"bytes,1,rep,name=logs,proto3" json:"logs,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *LogResponse) Reset() { *m = LogResponse{} }
|
||||
func (m *LogResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogResponse) ProtoMessage() {}
|
||||
func (*LogResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a796f9dd3ce1270e, []int{6}
|
||||
}
|
||||
|
||||
func (m *LogResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_LogResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *LogResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_LogResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *LogResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_LogResponse.Merge(m, src)
|
||||
}
|
||||
func (m *LogResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_LogResponse.Size(m)
|
||||
}
|
||||
func (m *LogResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_LogResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_LogResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *LogResponse) GetLogs() []*Log {
|
||||
if m != nil {
|
||||
return m.Logs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type StatsResponse struct {
|
||||
Stats []*Stats `protobuf:"bytes,1,rep,name=stats,proto3" json:"stats,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_a796f9dd3ce1270e, []int{7}
|
||||
}
|
||||
|
||||
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) GetStats() []*Stats {
|
||||
if m != nil {
|
||||
return m.Stats
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type TraceResponse struct {
|
||||
Traces []*Trace `protobuf:"bytes,1,rep,name=traces,proto3" json:"traces,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_a796f9dd3ce1270e, []int{8}
|
||||
}
|
||||
|
||||
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) GetTraces() []*Trace {
|
||||
if m != nil {
|
||||
return m.Traces
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Check)(nil), "go.micro.debug.Check")
|
||||
proto.RegisterType((*Log)(nil), "go.micro.debug.Log")
|
||||
proto.RegisterType((*Stats)(nil), "go.micro.debug.Stats")
|
||||
proto.RegisterType((*Trace)(nil), "go.micro.debug.Trace")
|
||||
proto.RegisterType((*Request)(nil), "go.micro.debug.Request")
|
||||
proto.RegisterType((*HealthResponse)(nil), "go.micro.debug.HealthResponse")
|
||||
proto.RegisterType((*LogResponse)(nil), "go.micro.debug.LogResponse")
|
||||
proto.RegisterType((*StatsResponse)(nil), "go.micro.debug.StatsResponse")
|
||||
proto.RegisterType((*TraceResponse)(nil), "go.micro.debug.TraceResponse")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("go-debug/handler/rpc/proto/debug.proto", fileDescriptor_a796f9dd3ce1270e)
|
||||
}
|
||||
|
||||
var fileDescriptor_a796f9dd3ce1270e = []byte{
|
||||
// 312 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xc1, 0x4f, 0x83, 0x30,
|
||||
0x18, 0xc5, 0x37, 0x26, 0x2c, 0x7e, 0xcb, 0x38, 0xd4, 0xa8, 0x53, 0xa3, 0x59, 0x7a, 0xd0, 0x25,
|
||||
0x06, 0x48, 0x66, 0xe2, 0x49, 0x4d, 0xcc, 0x3c, 0x78, 0xd8, 0x09, 0x4d, 0x3c, 0x33, 0x68, 0x80,
|
||||
0x88, 0x2b, 0xb6, 0xe5, 0x0f, 0xf1, 0x3f, 0x36, 0xfd, 0xa8, 0x18, 0x70, 0x1c, 0xbc, 0xb5, 0x1f,
|
||||
0xef, 0xf7, 0xfa, 0xfa, 0x0a, 0x5c, 0xa6, 0xdc, 0x4b, 0xd8, 0xa6, 0x4a, 0x83, 0x2c, 0xda, 0x26,
|
||||
0x05, 0x13, 0x81, 0x28, 0xe3, 0xa0, 0x14, 0x5c, 0xf1, 0x00, 0xe7, 0x3e, 0xae, 0x89, 0x9b, 0x72,
|
||||
0xff, 0x23, 0x8f, 0x05, 0xf7, 0x71, 0x4a, 0xc7, 0x60, 0xaf, 0x32, 0x16, 0xbf, 0x53, 0x1b, 0x46,
|
||||
0x6b, 0x8e, 0xfb, 0x17, 0x15, 0x29, 0xa9, 0x17, 0xaf, 0x22, 0x8a, 0x19, 0x3d, 0x81, 0x71, 0xc8,
|
||||
0x3e, 0x2b, 0x26, 0x15, 0x71, 0xc1, 0xca, 0x93, 0xd9, 0x70, 0x3e, 0x5c, 0xec, 0x87, 0x56, 0x9e,
|
||||
0xd0, 0x37, 0x70, 0x9f, 0x59, 0x54, 0xa8, 0x2c, 0x64, 0xb2, 0xe4, 0x5b, 0xc9, 0xc8, 0x11, 0x38,
|
||||
0x52, 0x45, 0xaa, 0x92, 0x46, 0x65, 0x76, 0xc4, 0x03, 0x27, 0xd6, 0xc7, 0xc8, 0x99, 0x35, 0x1f,
|
||||
0x2d, 0x26, 0xcb, 0x43, 0xbf, 0x9d, 0xc3, 0xc7, 0x10, 0xa1, 0x11, 0xd1, 0x5b, 0x98, 0xac, 0x79,
|
||||
0xda, 0xb8, 0x5e, 0xc1, 0x5e, 0xc1, 0x53, 0xed, 0xa9, 0xd9, 0x83, 0x2e, 0xab, 0xa5, 0x28, 0xa0,
|
||||
0x77, 0x30, 0xc5, 0xf4, 0x0d, 0x79, 0x0d, 0xb6, 0x4e, 0xf0, 0x83, 0xfe, 0x39, 0xb6, 0x56, 0xd7,
|
||||
0x1a, 0xfa, 0x00, 0x53, 0xbc, 0x72, 0x43, 0x7b, 0xe0, 0x28, 0x3d, 0xe8, 0xc5, 0x6b, 0xb9, 0x11,
|
||||
0x2d, 0xbf, 0x2c, 0xb0, 0x9f, 0xf4, 0x9c, 0xac, 0xc0, 0xa9, 0x8b, 0x21, 0xc7, 0x5d, 0xc4, 0x74,
|
||||
0x79, 0x7a, 0xd1, 0xfd, 0xd0, 0x6e, 0x92, 0x0e, 0xc8, 0x3d, 0xbe, 0x48, 0xbf, 0xc3, 0xd9, 0xae,
|
||||
0x1e, 0x7e, 0xf1, 0x47, 0xf3, 0x92, 0xfd, 0x06, 0xe7, 0xbb, 0xdb, 0x68, 0x59, 0xe0, 0x0d, 0xff,
|
||||
0x61, 0xd1, 0x2a, 0x90, 0x0e, 0x36, 0x0e, 0xfe, 0x76, 0x37, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff,
|
||||
0x76, 0x9d, 0x79, 0xec, 0xa0, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// DebugClient is the client API for Debug service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type DebugClient interface {
|
||||
Health(ctx context.Context, in *Request, opts ...grpc.CallOption) (*HealthResponse, error)
|
||||
Log(ctx context.Context, in *Request, opts ...grpc.CallOption) (*LogResponse, error)
|
||||
Stats(ctx context.Context, in *Request, opts ...grpc.CallOption) (*StatsResponse, error)
|
||||
Trace(ctx context.Context, in *Request, opts ...grpc.CallOption) (*TraceResponse, error)
|
||||
}
|
||||
|
||||
type debugClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewDebugClient(cc *grpc.ClientConn) DebugClient {
|
||||
return &debugClient{cc}
|
||||
}
|
||||
|
||||
func (c *debugClient) Health(ctx context.Context, in *Request, opts ...grpc.CallOption) (*HealthResponse, error) {
|
||||
out := new(HealthResponse)
|
||||
err := c.cc.Invoke(ctx, "/go.micro.debug.Debug/Health", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *debugClient) Log(ctx context.Context, in *Request, opts ...grpc.CallOption) (*LogResponse, error) {
|
||||
out := new(LogResponse)
|
||||
err := c.cc.Invoke(ctx, "/go.micro.debug.Debug/Log", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *debugClient) Stats(ctx context.Context, in *Request, opts ...grpc.CallOption) (*StatsResponse, error) {
|
||||
out := new(StatsResponse)
|
||||
err := c.cc.Invoke(ctx, "/go.micro.debug.Debug/Stats", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *debugClient) Trace(ctx context.Context, in *Request, opts ...grpc.CallOption) (*TraceResponse, error) {
|
||||
out := new(TraceResponse)
|
||||
err := c.cc.Invoke(ctx, "/go.micro.debug.Debug/Trace", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// DebugServer is the server API for Debug service.
|
||||
type DebugServer interface {
|
||||
Health(context.Context, *Request) (*HealthResponse, error)
|
||||
Log(context.Context, *Request) (*LogResponse, error)
|
||||
Stats(context.Context, *Request) (*StatsResponse, error)
|
||||
Trace(context.Context, *Request) (*TraceResponse, error)
|
||||
}
|
||||
|
||||
func RegisterDebugServer(s *grpc.Server, srv DebugServer) {
|
||||
s.RegisterService(&_Debug_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Debug_Health_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Request)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DebugServer).Health(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/go.micro.debug.Debug/Health",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DebugServer).Health(ctx, req.(*Request))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Debug_Log_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Request)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DebugServer).Log(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/go.micro.debug.Debug/Log",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DebugServer).Log(ctx, req.(*Request))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Debug_Stats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Request)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DebugServer).Stats(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/go.micro.debug.Debug/Stats",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DebugServer).Stats(ctx, req.(*Request))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Debug_Trace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Request)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DebugServer).Trace(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/go.micro.debug.Debug/Trace",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DebugServer).Trace(ctx, req.(*Request))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Debug_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "go.micro.debug.Debug",
|
||||
HandlerType: (*DebugServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Health",
|
||||
Handler: _Debug_Health_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Log",
|
||||
Handler: _Debug_Log_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Stats",
|
||||
Handler: _Debug_Stats_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Trace",
|
||||
Handler: _Debug_Trace_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "go-debug/handler/rpc/proto/debug.proto",
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package go.micro.debug;
|
||||
|
||||
service Debug {
|
||||
rpc Health(Request) returns (HealthResponse) {};
|
||||
rpc Log(Request) returns (LogResponse) {};
|
||||
rpc Stats(Request) returns (StatsResponse) {};
|
||||
rpc Trace(Request) returns (TraceResponse) {};
|
||||
}
|
||||
|
||||
message Check {}
|
||||
message Log {}
|
||||
message Stats {}
|
||||
message Trace {}
|
||||
|
||||
message Request {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message HealthResponse {
|
||||
string status = 1;
|
||||
repeated Check checks = 2;
|
||||
}
|
||||
|
||||
message LogResponse {
|
||||
repeated Log logs = 1;
|
||||
}
|
||||
|
||||
message StatsResponse {
|
||||
repeated Stats stats = 1;
|
||||
}
|
||||
|
||||
message TraceResponse {
|
||||
repeated Trace traces = 1;
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
// Package rpc provides an rpc handler
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
proto "github.com/micro/go-micro/debug/handler/rpc/proto"
|
||||
)
|
||||
|
||||
type Debug struct {
|
||||
}
|
||||
|
||||
func (d *Debug) Health(ctx context.Context, req *proto.Request, rsp *proto.HealthResponse) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *Debug) Log(ctx context.Context, req *proto.Request, rsp *proto.LogResponse) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *Debug) Stats(ctx context.Context, req *proto.Request, rsp *proto.StatsResponse) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *Debug) Trace(ctx context.Context, req *proto.Request, rsp *proto.TraceResponse) error {
|
||||
return nil
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
// Package health is for user defined health checks
|
||||
package health
|
||||
|
||||
type Health interface {
|
||||
Register([]*Check) error
|
||||
Read(...ReadOption) ([]*Check, error)
|
||||
Check(...CheckOption) ([]*Status, error)
|
||||
String() string
|
||||
}
|
||||
|
||||
type Check struct {
|
||||
Id string
|
||||
Metadata map[string]string
|
||||
Exec func() (*Status, error)
|
||||
}
|
||||
|
||||
type Status struct {
|
||||
Code int
|
||||
Detail string
|
||||
}
|
||||
|
||||
type CheckOptions struct{}
|
||||
|
||||
type CheckOption func(o *CheckOptions)
|
||||
|
||||
type ReadOptions struct{}
|
||||
|
||||
type ReadOption func(o *ReadOptions)
|
@ -1,36 +0,0 @@
|
||||
// Package log provides a logging interface
|
||||
package log
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Log provides access to logs
|
||||
type Log interface {
|
||||
Read(...ReadOption) ([]*Entry, error)
|
||||
Write([]*Entry, ...WriteOption) error
|
||||
String() string
|
||||
}
|
||||
|
||||
// A single log entry
|
||||
type Entry struct {
|
||||
Id string
|
||||
Time time.Time
|
||||
Message []byte
|
||||
Metadata map[string]string
|
||||
}
|
||||
|
||||
type ReadOption func(o *ReadOptions)
|
||||
|
||||
type WriteOption func(o *WriteOptions)
|
||||
|
||||
type ReadOptions struct {
|
||||
// read the given id
|
||||
Id string
|
||||
// Number of entries to read
|
||||
Entries int
|
||||
// Filter function
|
||||
Filter func(*Entry) bool
|
||||
}
|
||||
|
||||
type WriteOptions struct{}
|
@ -1,24 +0,0 @@
|
||||
// Package stats provides process statistics
|
||||
package stats
|
||||
|
||||
// Stats provides metrics recording and retrieval
|
||||
type Stats interface {
|
||||
Read(...ReadOption) []*Metrics
|
||||
Record(*Metrics) error
|
||||
String() string
|
||||
}
|
||||
|
||||
type Metrics struct {
|
||||
// Unique id of metric
|
||||
Id string
|
||||
// Metadata
|
||||
Metadata map[string]string
|
||||
// Floating values
|
||||
Values map[string]float64
|
||||
// Counters
|
||||
Counters map[string]int64
|
||||
}
|
||||
|
||||
type ReadOptions struct{}
|
||||
|
||||
type ReadOption func(o *ReadOptions)
|
@ -1,62 +0,0 @@
|
||||
// Package buffer provides a simple ring buffer
|
||||
package buffer
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/micro/go-micro/debug/store"
|
||||
)
|
||||
|
||||
type Buffer struct {
|
||||
sync.RWMutex
|
||||
index map[string]int
|
||||
records []*store.Record
|
||||
}
|
||||
|
||||
func (b *Buffer) Read(opts ...store.ReadOption) ([]*store.Record, error) {
|
||||
var options store.ReadOptions
|
||||
for _, o := range opts {
|
||||
o(&options)
|
||||
}
|
||||
|
||||
b.RLock()
|
||||
defer b.RUnlock()
|
||||
|
||||
if len(options.Id) > 0 {
|
||||
idx, ok := b.index[options.Id]
|
||||
if !ok || len(b.records) < idx {
|
||||
return nil, store.ErrNotFound
|
||||
}
|
||||
return []*store.Record{b.records[idx]}, nil
|
||||
}
|
||||
|
||||
return b.records, nil
|
||||
}
|
||||
|
||||
func (b *Buffer) Write(records []*store.Record) error {
|
||||
b.Lock()
|
||||
defer b.Unlock()
|
||||
|
||||
if b.index == nil {
|
||||
b.index = make(map[string]int)
|
||||
}
|
||||
|
||||
i := len(b.records)
|
||||
|
||||
for _, r := range records {
|
||||
b.index[r.Id] = i
|
||||
i++
|
||||
b.records = append(b.records, r)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Buffer) String() string {
|
||||
return "buffer"
|
||||
}
|
||||
|
||||
type Record struct {
|
||||
Id string
|
||||
Value interface{}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
// Package store stores the various pieces of data
|
||||
package store
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
type Store interface {
|
||||
Read(...ReadOption) ([]*Record, error)
|
||||
Write([]*Record) error
|
||||
String() string
|
||||
}
|
||||
|
||||
type Record struct {
|
||||
Id string
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
type ReadOptions struct {
|
||||
Id string
|
||||
}
|
||||
|
||||
type ReadOption func(o *ReadOptions)
|
||||
|
||||
var (
|
||||
ErrNotFound = errors.New("not found")
|
||||
)
|
@ -1,29 +0,0 @@
|
||||
// Package trace provides a tracing interface
|
||||
package trace
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Trace is for request tracing
|
||||
type Trace interface {
|
||||
// Read the traces
|
||||
Read(...ReadOption) ([]*Span, error)
|
||||
// Collect traces
|
||||
Collect([]*Span) error
|
||||
// Name of tracer
|
||||
String() string
|
||||
}
|
||||
|
||||
type Span struct {
|
||||
Id string
|
||||
Name string
|
||||
Trace string
|
||||
Metadata map[string]string
|
||||
Start time.Time
|
||||
Finish time.Time
|
||||
}
|
||||
|
||||
type ReadOptions struct{}
|
||||
|
||||
type ReadOption func(o *ReadOptions)
|
Loading…
Reference in New Issue
Block a user