I've tested this on both Go 1.12 and Go 1.13: I added tracing to my application and noticed a lag between when AppEngine reports receiving the request and when my application registers receiving the request. In order to eliminate any of my middlewares/setup process as the culprit, I made a barebones handler to test the latency (code found below) and notice anywhere between a ~30-90ms lag time from when AppEngine starts the trace until my application registers the request. This is after I let it "warm" up first with 10 requests.
in Go 1.12:
Browser TTFB: 112.69ms
StackDriver Trace Output:
@0 ms (HTTP load balancer )
Traced time 62.974 ms
Untraced time 46.026 ms
@18.913 ms (AppEngine Entry)
Traced time 0.073 ms
Untraced time 62.901 ms
@50.164 ms (My Application)
in Go 1.13:
Browser TTFB: 62.19ms
StackDriver Trace Output:
@0 ms (HTTP load balancer )
Traced time 21.039 ms
Untraced time 41.961 ms
@18.053 ms (AppEngine Entry)
Traced time 0.066 ms
Untraced time 20.973 ms
@38.181 ms (My Application)
This feels higher than it should but I was curious if this is expected?
app.yaml:
runtime: go112 # or go113
go.mod:
main.go:
ctx := context.Background()
exp, err := stackdriver.NewExporter(stackdriver.Options{
ProjectID: os.Getenv("GOOGLE_CLOUD_PROJECT"),
trace.RegisterExporter(exp)
http.HandleFunc("/", indexHandler)
h := TraceHandler(http.DefaultServeMux)
port := os.Getenv("PORT")
log.Printf("Defaulting to port %s", port)
log.Printf("Listening on port %s", port)
if err := http.ListenAndServe(":"+port, h); err != nil {
// TraceHandler sets up OpenCensus middleware for tracing and stats
func TraceHandler(h http.Handler) http.Handler {
Propagation: &propagation.HTTPFormat{},
func indexHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello, World!")
Thank you,
Prateek