Skip to content

Commit

Permalink
emitter: simplify to 1 generated stacktrace only
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellzy committed May 27, 2024
1 parent 010d76b commit 20078e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/appsec/emitter/httpsec/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ 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) {
blocking = true
bypassHandler = a.Handler
})
dyngo.OnData(op, func(a *sharedsec.StackTraceAction) {
stackTraces = append(stackTraces, &a.Event)
stackTrace = a.Event
})
})
r = r.WithContext(ctx)
Expand All @@ -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)
Expand Down

0 comments on commit 20078e1

Please sign in to comment.