Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/router-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- 'composition-go/**/*'
- 'demo/**/*'
- 'router/**/*'
- 'router-plugin/**/*'
- 'router-tests/**/*'
- 'connect/**/*'
- '.github/workflows/router-ci.yaml'
Expand Down
19 changes: 5 additions & 14 deletions router-plugin/tracing/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions router/pkg/grpcconnector/grpc_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading