use metadata.Metadata (#8)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -29,8 +29,8 @@ func FromContext(ctx context.Context) (traceID string, parentSpanID string, isFo
|
||||
|
||||
// NewContext saves the trace and span ids in the context
|
||||
func NewContext(ctx context.Context, traceID, parentSpanID string) context.Context {
|
||||
return metadata.MergeContext(ctx, map[string]string{
|
||||
traceIDKey: traceID,
|
||||
spanIDKey: parentSpanID,
|
||||
}, true)
|
||||
md := metadata.New(2)
|
||||
md.Set(traceIDKey, traceID)
|
||||
md.Set(spanIDKey, parentSpanID)
|
||||
return metadata.MergeContext(ctx, md, true)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ package tracer
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/unistack-org/micro/v3/metadata"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -46,7 +48,7 @@ type Span struct {
|
||||
// Duration in nano seconds
|
||||
Duration time.Duration
|
||||
// associated data
|
||||
Metadata map[string]string
|
||||
Metadata metadata.Metadata
|
||||
// Type
|
||||
Type SpanType
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user