1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-12 22:07:47 +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

@ -63,6 +63,7 @@ func (c *clientWrapper) Publish(ctx context.Context, p client.Message, opts ...c
func (c *traceWrapper) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error {
newCtx, s := c.trace.Start(ctx, req.Service()+"."+req.Endpoint())
s.Type = trace.SpanTypeRequestOutbound
err := c.Client.Call(newCtx, req, rsp, opts...)
if err != nil {
s.Metadata["error"] = err.Error()
@ -122,6 +123,7 @@ func TraceHandler(t trace.Tracer) server.HandlerWrapper {
// get the span
newCtx, s := t.Start(ctx, req.Service()+"."+req.Endpoint())
s.Type = trace.SpanTypeRequestInbound
err := h(newCtx, req, rsp)
if err != nil {