Skip to content

[BUG]: panic if http.DefaultTransport is replaced #642

Description

@austindrenski

Runtime panic in v1.55.1 if http.DefaultTransport has been replaced, following the changes in #641:

transport := http.DefaultTransport.(*http.Transport).Clone()

e.g.,

import (
	"net/http"
	"net/http/httptrace"

	"go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace"
	"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
)

// ...

http.DefaultTransport = otelhttp.NewTransport(http.DefaultTransport, otelhttp.WithClientTrace(func(ctx context.Context) *httptrace.ClientTrace {
	return otelhttptrace.NewClientTrace(ctx)
}))

https://github.com/open-telemetry/opentelemetry-go-contrib/blob/ce138eb092f223e4e41e0420c58fc34910bc2b56/instrumentation/net/http/otelhttp/transport.go#L44-L68

See: #641

/cc @benrkia

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions