get trace info from context
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
e1f85545d9
commit
9f6620676a
@ -88,6 +88,12 @@ func (t *otTracer) Start(ctx context.Context, name string, opts ...tracer.SpanOp
|
|||||||
_ = span.Tracer().Inject(spctx, ot.TextMap, ot.TextMapCarrier(carrier))
|
_ = span.Tracer().Inject(spctx, ot.TextMap, ot.TextMapCarrier(carrier))
|
||||||
for k, v := range carrier {
|
for k, v := range carrier {
|
||||||
switch k {
|
switch k {
|
||||||
|
case "mockpfx-ids-sampled":
|
||||||
|
continue
|
||||||
|
case "mockpfx-ids-spanid":
|
||||||
|
spanID = v
|
||||||
|
case "mockpfx-ids-traceid":
|
||||||
|
traceID = v
|
||||||
default: // reasonable default
|
default: // reasonable default
|
||||||
p := strings.Split(v, ":")
|
p := strings.Split(v, ":")
|
||||||
traceID = p[0]
|
traceID = p[0]
|
||||||
|
@ -86,7 +86,7 @@ func TestRealTraceID(t *testing.T) {
|
|||||||
}
|
}
|
||||||
l.Info(ctx, "msg")
|
l.Info(ctx, "msg")
|
||||||
}
|
}
|
||||||
*
|
*/
|
||||||
|
|
||||||
func TestTraceTags(t *testing.T) {
|
func TestTraceTags(t *testing.T) {
|
||||||
md := metadata.New(1)
|
md := metadata.New(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user