improve tracing
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
9f6620676a
commit
89f75e0431
@ -321,11 +321,15 @@ func (t *otTracer) startSpanFromOutgoingContext(ctx context.Context, name string
|
|||||||
}
|
}
|
||||||
|
|
||||||
nmd := metadata.Copy(md)
|
nmd := metadata.Copy(md)
|
||||||
|
smd := metadata.New(1)
|
||||||
|
|
||||||
sp := t.tracer.StartSpan(name, opts...)
|
sp := t.tracer.StartSpan(name, opts...)
|
||||||
if err := sp.Tracer().Inject(sp.Context(), ot.TextMap, ot.TextMapCarrier(nmd)); err != nil {
|
if err := sp.Tracer().Inject(sp.Context(), ot.TextMap, ot.TextMapCarrier(smd)); err != nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
for k, v := range smd {
|
||||||
|
nmd.Set(k, v)
|
||||||
|
}
|
||||||
|
|
||||||
ctx = metadata.NewOutgoingContext(ot.ContextWithSpan(ctx, sp), nmd)
|
ctx = metadata.NewOutgoingContext(ot.ContextWithSpan(ctx, sp), nmd)
|
||||||
|
|
||||||
@ -364,11 +368,15 @@ func (t *otTracer) startSpanFromIncomingContext(ctx context.Context, name string
|
|||||||
}
|
}
|
||||||
|
|
||||||
nmd := metadata.Copy(md)
|
nmd := metadata.Copy(md)
|
||||||
|
smd := metadata.New(1)
|
||||||
|
|
||||||
sp := t.tracer.StartSpan(name, opts...)
|
sp := t.tracer.StartSpan(name, opts...)
|
||||||
if err := sp.Tracer().Inject(sp.Context(), ot.TextMap, ot.TextMapCarrier(nmd)); err != nil {
|
if err := sp.Tracer().Inject(sp.Context(), ot.TextMap, ot.TextMapCarrier(smd)); err != nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
for k, v := range smd {
|
||||||
|
nmd.Set(k, v)
|
||||||
|
}
|
||||||
|
|
||||||
ctx = metadata.NewIncomingContext(ot.ContextWithSpan(ctx, sp), nmd)
|
ctx = metadata.NewIncomingContext(ot.ContextWithSpan(ctx, sp), nmd)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user