add tracing

This commit is contained in:
Asim Aslam
2020-01-30 23:24:46 +00:00
parent 21e0932339
commit 0be22c98c6
5 changed files with 97 additions and 87 deletions

View File

@@ -6,7 +6,6 @@ import (
"time"
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/debug/log"
pb "github.com/micro/go-micro/v2/debug/service/proto"
)
@@ -16,6 +15,14 @@ type debugClient struct {
Client pb.DebugService
}
func (d *debugClient) Trace() ([]*pb.Span, error) {
rsp, err := d.Client.Trace(context.Background(), &pb.TraceRequest{})
if err != nil {
return nil, err
}
return rsp.Spans, nil
}
// Logs queries the services logs and returns a channel to read the logs from
func (d *debugClient) Log(since time.Time, count int, stream bool) (log.Stream, error) {
req := &pb.LogRequest{}