Skip to content

Commit

Permalink
add tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
asim committed Jan 30, 2020
1 parent 21e0932 commit 0be22c9
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 63 deletions.
1 change: 0 additions & 1 deletion config/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ var (
Name: "tracer",
EnvVars: []string{"MICRO_TRACER"},
Usage: "Tracer for distributed tracing, e.g. memory, jaeger",
Value: "memory",
},
&cli.StringFlag{
Name: "tracer_address",
Expand Down
9 changes: 8 additions & 1 deletion debug/service/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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{}
Expand Down
46 changes: 23 additions & 23 deletions debug/service/proto/debug.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 41 additions & 37 deletions debug/service/proto/debug.pb.micro.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion debug/service/proto/debug.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
syntax = "proto3";

service Debug {
rpc Log(LogRequest) returns (stream Record) {};
rpc Health(HealthRequest) returns (HealthResponse) {};
rpc Stats(StatsRequest) returns (StatsResponse) {};
rpc Log(LogRequest) returns (stream Record) {};
rpc Trace(TraceRequest) returns (TraceResponse) {};
}

Expand Down

0 comments on commit 0be22c9

Please sign in to comment.