diff --git a/.github/workflows/router-ci.yaml b/.github/workflows/router-ci.yaml index 303bd51b0a..95f6728256 100644 --- a/.github/workflows/router-ci.yaml +++ b/.github/workflows/router-ci.yaml @@ -6,6 +6,7 @@ on: - 'composition-go/**/*' - 'demo/**/*' - 'router/**/*' + - 'router-plugin/**/*' - 'router-tests/**/*' - 'connect/**/*' - '.github/workflows/router-ci.yaml' diff --git a/router-plugin/tracing/interceptor.go b/router-plugin/tracing/interceptor.go index da6febe29b..bf7eba0048 100644 --- a/router-plugin/tracing/interceptor.go +++ b/router-plugin/tracing/interceptor.go @@ -12,12 +12,6 @@ import ( "google.golang.org/grpc/metadata" ) -const ( - traceparentHeader = "traceparent" - tracestateHeader = "tracestate" - baggageHeader = "baggage" -) - func CreateTracingInterceptor(tracingOpts TracingOptions) (func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error), error) { if tracingOpts.TracingConfig == nil { return nil, errors.New("nil tracing config not supported") @@ -33,15 +27,12 @@ func CreateTracingInterceptor(tracingOpts TracingOptions) (func(ctx context.Cont return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { if md, ok := metadata.FromIncomingContext(ctx); ok { + // Extract headers from the incoming context carrier := propagation.MapCarrier{} - if values := md.Get(traceparentHeader); len(values) > 0 { - carrier[traceparentHeader] = values[0] - } - if values := md.Get(tracestateHeader); len(values) > 0 { - carrier[tracestateHeader] = values[0] - } - if values := md.Get(baggageHeader); len(values) > 0 { - carrier[baggageHeader] = values[0] + for key, values := range md { + if len(values) > 0 { + carrier[key] = values[0] + } } propagator := otel.GetTextMapPropagator() ctx = propagator.Extract(ctx, carrier) diff --git a/router/pkg/grpcconnector/grpc_plugin.go b/router/pkg/grpcconnector/grpc_plugin.go index fb580a8ac6..64b3b4427c 100644 --- a/router/pkg/grpcconnector/grpc_plugin.go +++ b/router/pkg/grpcconnector/grpc_plugin.go @@ -97,8 +97,9 @@ func (p *GRPCPlugin) fork() error { pluginCmd := newPluginCommand(filePath) - // This is the same as SkipHostEnv false - // except that we do that first so that any params are not overriden + // This is the same as SkipHostEnv false, except + // that we set the base env variables first so that any params + // that may contain the same name are not overridden pluginCmd.Env = append(pluginCmd.Env, os.Environ()...) configJson, err := json.Marshal(p.startupConfig)