Created
May 28, 2019 20:40
-
-
Save graphaelli/eb84744c57c0b66b61a131a34db851e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/vendor/go.elastic.co/apm/module/apmhttp/handler.go b/vendor/go.elastic.co/apm/module/apmhttp/handler.go | |
index 2614c2c4..169d2fe5 100644 | |
--- a/vendor/go.elastic.co/apm/module/apmhttp/handler.go | |
+++ b/vendor/go.elastic.co/apm/module/apmhttp/handler.go | |
@@ -2,6 +2,8 @@ package apmhttp | |
import ( | |
"context" | |
+ "log" | |
+ "runtime/debug" | |
"net/http" | |
"go.elastic.co/apm" | |
@@ -164,11 +166,18 @@ type Response struct { | |
type responseWriter struct { | |
http.ResponseWriter | |
resp Response | |
+ writeHeaderCalls [][]byte | |
} | |
// WriteHeader sets w.resp.StatusCode and calls through to the embedded | |
// ResponseWriter. | |
func (w *responseWriter) WriteHeader(statusCode int) { | |
+ w.writeHeaderCalls = append(w.writeHeaderCalls, debug.Stack()) | |
+ if len(w.writeHeaderCalls) > 1 { | |
+ for i, stack := range w.writeHeaderCalls { | |
+ log.Printf("stack %d:\n%s", i, stack) | |
+ } | |
+ } | |
w.ResponseWriter.WriteHeader(statusCode) | |
w.resp.StatusCode = statusCode | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment