census-instrumentation/opencensus-go

GetStartOptions not ignoring "/" path

Talento90 opened this issue · 0 comments

It seems that using GetStartOptions ignores the OPTIONS http method but not the "/" path. If I go to StackDriver I can still see the / traces. :(

Handler: &ochttp.Handler{
	Handler: router,
	GetStartOptions: func(r *http.Request) trace.StartOptions {
		if r.Method == http.MethodOptions || r.URL.Path == "/" {
			return trace.StartOptions{
				Sampler:  trace.NeverSample(),
				SpanKind: trace.SpanKindServer,
			}
		}

		return trace.StartOptions{
			Sampler:  trace.AlwaysSample(),
			SpanKind: trace.SpanKindServer,
		}
	},
},