refactor(rest): use static config for trace ignore paths. (#2773)

This commit is contained in:
cong
2023-01-12 09:40:18 +08:00
committed by GitHub
parent bae061a67e
commit f9619328f2
4 changed files with 35 additions and 15 deletions

View File

@@ -63,12 +63,9 @@ func TestDontTracingSpan(t *testing.T) {
})
defer ztrace.StopAgent()
DontTraceSpan("bar")
defer notTracingSpans.Delete("bar")
for _, test := range []string{"", "bar", "foo"} {
t.Run(test, func(t *testing.T) {
h := chain.New(TracingHandler("foo", test)).Then(
h := chain.New(TracingHandler("foo", test, WithTraceIgnorePaths([]string{"bar"}))).Then(
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
span := trace.SpanFromContext(r.Context())
spanCtx := span.SpanContext()