From 20078e1f4668e34a03e6aaf3b3c7cc370028ba70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mazeau?= Date: Mon, 27 May 2024 09:42:54 +0200 Subject: [PATCH] emitter: simplify to 1 generated stacktrace only --- internal/appsec/emitter/httpsec/http.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/appsec/emitter/httpsec/http.go b/internal/appsec/emitter/httpsec/http.go index 4ca19de679..bc2f757a07 100644 --- a/internal/appsec/emitter/httpsec/http.go +++ b/internal/appsec/emitter/httpsec/http.go @@ -78,7 +78,7 @@ func WrapHandler(handler http.Handler, span ddtrace.Span, pathParams map[string] var bypassHandler http.Handler var blocking bool - var stackTraces []*stacktrace.Event + var stackTrace stacktrace.Event args := MakeHandlerOperationArgs(r, clientIP, pathParams) ctx, op := StartOperation(r.Context(), args, func(op *types.Operation) { dyngo.OnData(op, func(a *sharedsec.HTTPAction) { @@ -86,7 +86,7 @@ func WrapHandler(handler http.Handler, span ddtrace.Span, pathParams map[string] bypassHandler = a.Handler }) dyngo.OnData(op, func(a *sharedsec.StackTraceAction) { - stackTraces = append(stackTraces, &a.Event) + stackTrace = a.Event }) }) r = r.WithContext(ctx) @@ -104,7 +104,7 @@ func WrapHandler(handler http.Handler, span ddtrace.Span, pathParams map[string] } // Add stacktraces to the span, if any - stacktrace.AddToSpan(span, stackTraces...) + stacktrace.AddToSpan(span, &stackTrace) if bypassHandler != nil { bypassHandler.ServeHTTP(w, r)