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
No related branches found
No related tags found
No related merge requests found
...@@ -72,7 +72,10 @@ func getServiceName() string { ...@@ -72,7 +72,10 @@ func getServiceName() string {
if s := os.Getenv("TRACING_SERVICE"); s != "" { if s := os.Getenv("TRACING_SERVICE"); s != "" {
return 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 { func defaultResource(serviceName string) *resource.Resource {
...@@ -143,7 +146,7 @@ func initTracing(serviceName string) { ...@@ -143,7 +146,7 @@ func initTracing(serviceName string) {
// Init tracing support, if not using WrapHandler. // Init tracing support, if not using WrapHandler.
func Init() { func Init() {
initTracing("") initTracing(getServiceName())
} }
// WrapTransport optionally wraps a http.RoundTripper with OpenCensus // WrapTransport optionally wraps a http.RoundTripper with OpenCensus
...@@ -152,7 +155,7 @@ func Init() { ...@@ -152,7 +155,7 @@ func Init() {
// Must call Init() first. // Must call Init() first.
func WrapTransport(t http.RoundTripper) http.RoundTripper { func WrapTransport(t http.RoundTripper) http.RoundTripper {
if Enabled { if Enabled {
t = othttp.NewTransport(t) t = othttp.NewTransport(t, othttp.WithPublicEndpoint())
} }
return t return t
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment