|
|
@ -17,9 +17,11 @@ var _ propagation.TextMapPropagator = Metadata{} |
|
|
|
|
|
|
|
|
|
|
|
// Inject sets metadata key-values from ctx into the carrier.
|
|
|
|
// Inject sets metadata key-values from ctx into the carrier.
|
|
|
|
func (b Metadata) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { |
|
|
|
func (b Metadata) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { |
|
|
|
app, _ := kratos.FromContext(ctx) |
|
|
|
app, ok := kratos.FromContext(ctx) |
|
|
|
|
|
|
|
if ok { |
|
|
|
carrier.Set(serviceHeader, app.Name()) |
|
|
|
carrier.Set(serviceHeader, app.Name()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Extract returns a copy of parent with the metadata from the carrier added.
|
|
|
|
// Extract returns a copy of parent with the metadata from the carrier added.
|
|
|
|
func (b Metadata) Extract(parent context.Context, carrier propagation.TextMapCarrier) context.Context { |
|
|
|
func (b Metadata) Extract(parent context.Context, carrier propagation.TextMapCarrier) context.Context { |
|
|
|