Skip to content
Snippets Groups Projects
Commit 6d669b91 authored by ale's avatar ale
Browse files

Set WithPublicEndpoint() on the otelhttp client tracer

Should prevent creation of client spans unless there's an incoming
parent span already.
parent 310a9601
Branches
No related tags found
No related merge requests found
......@@ -72,7 +72,10 @@ func getServiceName() string {
if s := os.Getenv("TRACING_SERVICE"); s != "" {
return s
}
return filepath.Base(os.Args[0])
if s, err := os.Executable(); err == nil {
return filepath.Base(s)
}
return "unknown_service"
}
func defaultResource(serviceName string) *resource.Resource {
......@@ -143,7 +146,7 @@ func initTracing(serviceName string) {
// Init tracing support, if not using WrapHandler.
func Init() {
initTracing("")
initTracing(getServiceName())
}
// WrapTransport optionally wraps a http.RoundTripper with OpenCensus
......@@ -152,7 +155,7 @@ func Init() {
// Must call Init() first.
func WrapTransport(t http.RoundTripper) http.RoundTripper {
if Enabled {
t = othttp.NewTransport(t)
t = othttp.NewTransport(t, othttp.WithPublicEndpoint())
}
return t
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment