1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-24 22:26:54 +02:00

Trace type is now being recorded (#1188)

This commit is contained in:
Janos Dobronszki
2020-02-12 11:57:17 +01:00
committed by GitHub
parent 79ad1e6fe3
commit d76baf59de
5 changed files with 117 additions and 51 deletions

View File

@ -66,15 +66,23 @@ func (d *Debug) Trace(ctx context.Context, req *proto.TraceRequest, rsp *proto.T
return err
}
for _, trace := range traces {
for _, t := range traces {
var typ proto.SpanType
switch t.Type {
case trace.SpanTypeRequestInbound:
typ = proto.SpanType_INBOUND
case trace.SpanTypeRequestOutbound:
typ = proto.SpanType_OUTBOUND
}
rsp.Spans = append(rsp.Spans, &proto.Span{
Trace: trace.Trace,
Id: trace.Id,
Parent: trace.Parent,
Name: trace.Name,
Started: uint64(trace.Started.UnixNano()),
Duration: uint64(trace.Duration.Nanoseconds()),
Metadata: trace.Metadata,
Trace: t.Trace,
Id: t.Id,
Parent: t.Parent,
Name: t.Name,
Started: uint64(t.Started.UnixNano()),
Duration: uint64(t.Duration.Nanoseconds()),
Type: typ,
Metadata: t.Metadata,
})
}