chore: refactor (#2545)

* chore: refactor

* chore: refactor
This commit is contained in:
Kevin Wan
2022-10-22 22:52:40 +08:00
committed by GitHub
parent 7fe2492009
commit 9cadab2684
4 changed files with 26 additions and 20 deletions

View File

@@ -12,11 +12,11 @@ import (
oteltrace "go.opentelemetry.io/otel/trace"
)
var dontTracingSpanNames sync.Map
var notTracingSpans sync.Map
// DontTracingSpanName disable tracing for the specified spanName.
func DontTracingSpanName(spanName string) {
dontTracingSpanNames.Store(spanName, lang.Placeholder)
// DontTraceSpan disable tracing for the specified span name.
func DontTraceSpan(spanName string) {
notTracingSpans.Store(spanName, lang.Placeholder)
}
// TracingHandler return a middleware that process the opentelemetry.
@@ -36,8 +36,7 @@ func TracingHandler(serviceName, path string) func(http.Handler) http.Handler {
spanName = r.URL.Path
}
_, ok := dontTracingSpanNames.Load(spanName)
if ok {
if _, ok := notTracingSpans.Load(spanName); ok {
return
}