Skip to content

Commit

Permalink
Merge pull request #1415 from jedevc/cherry-pick-1383-to-0.9
Browse files Browse the repository at this point in the history
[0.9] driver: don't create tracer delegate opt if tracer is nil
  • Loading branch information
crazy-max authored Nov 21, 2022
2 parents 4e93e87 + 83f3691 commit 2af40b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions driver/docker-container/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,14 @@ func (d *Driver) Client(ctx context.Context) (*client.Client, error) {
return nil, err
}

td, _ := exp.(client.TracerDelegate)

return client.New(ctx, "", client.WithContextDialer(func(context.Context, string) (net.Conn, error) {
var opts []client.ClientOpt
opts = append(opts, client.WithContextDialer(func(context.Context, string) (net.Conn, error) {
return conn, nil
}), client.WithTracerDelegate(td))
}))
if td, ok := exp.(client.TracerDelegate); ok {
opts = append(opts, client.WithTracerDelegate(td))
}
return client.New(ctx, "", opts...)
}

func (d *Driver) Factory() driver.Factory {
Expand Down
11 changes: 7 additions & 4 deletions driver/kubernetes/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,14 @@ func (d *Driver) Client(ctx context.Context) (*client.Client, error) {
return nil, err
}

td, _ := exp.(client.TracerDelegate)

return client.New(ctx, "", client.WithContextDialer(func(context.Context, string) (net.Conn, error) {
var opts []client.ClientOpt
opts = append(opts, client.WithContextDialer(func(context.Context, string) (net.Conn, error) {
return conn, nil
}), client.WithTracerDelegate(td))
}))
if td, ok := exp.(client.TracerDelegate); ok {
opts = append(opts, client.WithTracerDelegate(td))
}
return client.New(ctx, "", opts...)
}

func (d *Driver) Factory() driver.Factory {
Expand Down

0 comments on commit 2af40b7

Please sign in to comment.