mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-02-02 16:28:39 +08:00
Fix/del server interceptor duplicate copy md 20220827 (#2309)
* fix:grpc server interceptor duplicate copy MD * modify wrong comments
This commit is contained in:
parent
05007c86bb
commit
5d4ae201d0
@ -38,7 +38,7 @@ func (s *metadataSupplier) Keys() []string {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inject injects the metadata into ctx.
|
// Inject injects cross-cutting concerns from the ctx into the metadata.
|
||||||
func Inject(ctx context.Context, p propagation.TextMapPropagator, metadata *metadata.MD) {
|
func Inject(ctx context.Context, p propagation.TextMapPropagator, metadata *metadata.MD) {
|
||||||
p.Inject(ctx, &metadataSupplier{
|
p.Inject(ctx, &metadataSupplier{
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
|
@ -93,11 +93,8 @@ func (w *serverStream) SendMsg(m interface{}) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func startSpan(ctx context.Context, method string) (context.Context, trace.Span) {
|
func startSpan(ctx context.Context, method string) (context.Context, trace.Span) {
|
||||||
var md metadata.MD
|
md, ok := metadata.FromIncomingContext(ctx)
|
||||||
requestMetadata, ok := metadata.FromIncomingContext(ctx)
|
if !ok {
|
||||||
if ok {
|
|
||||||
md = requestMetadata.Copy()
|
|
||||||
} else {
|
|
||||||
md = metadata.MD{}
|
md = metadata.MD{}
|
||||||
}
|
}
|
||||||
bags, spanCtx := ztrace.Extract(ctx, otel.GetTextMapPropagator(), &md)
|
bags, spanCtx := ztrace.Extract(ctx, otel.GetTextMapPropagator(), &md)
|
||||||
|
Loading…
Reference in New Issue
Block a user